building a query for finding a value
-
hi! I have a problem with sql server. I want to find a record from a database, with like 30 tables in it, and lots of records. I don't know exactly where that record is, in which table. So, cause I am a beginner in SQL server, with the knowledge what I have, I did this: SELECT * FROM dbTest WHERE VALUES ='some value'; and it gives me error, near VALUES, so I don't know how to find it, any help will be welcomed, so I can resolve this issue. Thanks ahead
-
hi! I have a problem with sql server. I want to find a record from a database, with like 30 tables in it, and lots of records. I don't know exactly where that record is, in which table. So, cause I am a beginner in SQL server, with the knowledge what I have, I did this: SELECT * FROM dbTest WHERE VALUES ='some value'; and it gives me error, near VALUES, so I don't know how to find it, any help will be welcomed, so I can resolve this issue. Thanks ahead
laziale wrote:
I don't know exactly where that record is, in which table. So, cause I am a beginner in SQL server, with the knowledge what I have, I did this: SELECT * FROM dbTest WHERE VALUES ='some value'; and it gives me error, near VALUES, so I don't know how to find it,
Well, if dbTest is the name of the database then it won't work. You must specify the name of the table. If you don't know your database well enough to know where things are then you should be asking a colleague for some sort of ER diagram and data dictionary (documentation) to show you where things are.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
-
laziale wrote:
I don't know exactly where that record is, in which table. So, cause I am a beginner in SQL server, with the knowledge what I have, I did this: SELECT * FROM dbTest WHERE VALUES ='some value'; and it gives me error, near VALUES, so I don't know how to find it,
Well, if dbTest is the name of the database then it won't work. You must specify the name of the table. If you don't know your database well enough to know where things are then you should be asking a colleague for some sort of ER diagram and data dictionary (documentation) to show you where things are.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
-
hi! I have a problem with sql server. I want to find a record from a database, with like 30 tables in it, and lots of records. I don't know exactly where that record is, in which table. So, cause I am a beginner in SQL server, with the knowledge what I have, I did this: SELECT * FROM dbTest WHERE VALUES ='some value'; and it gives me error, near VALUES, so I don't know how to find it, any help will be welcomed, so I can resolve this issue. Thanks ahead
You have to give table name in select statement and if you want to search sometext from multiple tables, you should use multiple querires for multiple tables.
Do good and have good.
-
You have to give table name in select statement and if you want to search sometext from multiple tables, you should use multiple querires for multiple tables.
Do good and have good.
-
select * from tablename where columnname = 'sometext'; Please tell what is "Values" in your query? It must be the column name in your table on which you want to find the sometext.
Do good and have good.
-
select * from tablename where columnname = 'sometext'; Please tell what is "Values" in your query? It must be the column name in your table on which you want to find the sometext.
Do good and have good.
-
no, I know the name of the database, the name is dbo_Customers, but that database has around 30 tables, and lots of records inside, so any help on some query, to find the text, like 'sometext' will be helpfull. Thanks for replying
laziale wrote:
but that database has around 30 tables, and lots of records inside, so any help on some query, to find the text, like 'sometext' will be helpfull. Thanks for replying
You write 30 queries. Or you find out where the data is held. As I said, you need to ask for a ER diagram and data dictionary to find out how the database is structured and what it all means. Randomly fishing around inside tables for some value is really not the way to go.
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog
-
the value is 'noordzeeweg' but the think is that we don't know exactly in which table or column exactly is the record, and we have around 30 tables with lots of columns and records inside. Thx for helping
laziale wrote:
the value is 'noordzeeweg' but the think is that we don't know exactly in which table or column exactly is the record, and we have around 30 tables with lots of columns and records inside.
You say "we don't know" which implies that no one knows where this data is in your database. I therefore have to advise you to start creating documentation for your database. It is totally absurd to be running a database and not know what sort of information is in it and where it is. All I can say is that the value hints that it might be the name of a road or street. Do you have any tables that hold that kind of information?
Upcoming FREE developer events: * Developer Day Scotland Recent blog posts: * Mixins in C#3.0 My website | Blog