Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
aashirwaads
Starting Member
8 Posts |
Posted - 2008-01-25 : 04:49:07
|
| Hi Friends,I need help in a query...Just imagine there is a column which has values...Now I know the Column value but I am not able to find out the value belongs to which table and I dont know the column name too...Can I query using a Column Value to find out the Table name and Column Name?Thanks in advance. |
|
|
sunil
Constraint Violating Yak Guru
282 Posts |
Posted - 2008-01-25 : 05:10:49
|
| I believe this forum is not for any imagination or problems visulaized in dreams. Post proper problem with prosper data to get best help.Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
aashirwaads
Starting Member
8 Posts |
Posted - 2008-01-25 : 07:18:16
|
| Hi,I apologize...I have a value called "Release"...But I don't have information as to which table and column it belongs to....I just need to know whether I can find a Particular Table which contains this value?Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-01-25 : 08:56:29
|
| what is the reason for such a requirement? Can you tell from where you got the value which you are trying to search? |
 |
|
|
aashirwaads
Starting Member
8 Posts |
Posted - 2008-01-25 : 10:09:17
|
| AS I am creating reports....I need the data...they have given some data elements for me to include in the report and also they have given the sample data...So I have got the sample data but no clue about the table.Thanks |
 |
|
|
Sara Karasik
Starting Member
10 Posts |
Posted - 2008-01-25 : 11:59:09
|
| No problem.Get a list of all tables and column names, save into a temp table.select o.name as TableName, c.name as ColumnName into #ListToQueryfrom dbo.sysobjects ojoin dbo.syscolumns c on o.id = c.idwhere o.xtype = 'u'Be lazy. Let query analyzer do the writing of the code to query each and every column of each and every table.select 'if exists (select * from ' + TableName + ' where convert(varchar, ' + ColumnName + ') = ''Whatever it is I am looking for'') print ''' + TableName +'.'+ ColumnName + ''''from #ListToQueryTake the result set and paste it into a new window. Run it.Let me know if this helped. |
 |
|
|
|
|
|