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 |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2009-01-09 : 10:18:06
|
| I need to search three different tables within a MS SQL Server 2005 database. and return all the columns where the text 'AB12345' appears within any of the columns in the table(s)How can I do this please ,and return ther results as a CSV file? |
|
|
jhocutt
Constraint Violating Yak Guru
385 Posts |
Posted - 2009-01-09 : 10:19:36
|
| http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-09 : 10:36:29
|
quote: Originally posted by jhocutt http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
Just need to query INFORMATION_SCHEMA.COLUMNS. |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-09 : 10:42:18
|
quote: Originally posted by sodeep
quote: Originally posted by jhocutt http://vyaskn.tripod.com/search_all_columns_in_all_tables.htm"God does not play dice" -- Albert Einstein"Not only does God play dice, but he sometimes throws them where they cannot be seen." -- Stephen Hawking
Just need to query INFORMATION_SCHEMA.COLUMNS.
I think OP wants to know the columns in different tables which are containing the text 'AB12345' and not the columns( whose name whichcontains the text 'AB12345'). Isn't it?? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-09 : 11:33:42
|
| Sodeep i think raky is right.OP is looking at columns which contain 'AB12345' as a value |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-09 : 11:34:38
|
Yes She/He is right. |
 |
|
|
|
|
|