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 |
|
j0shua
Starting Member
40 Posts |
Posted - 2009-02-18 : 00:01:05
|
| if data are saved in a row or records like column11 select * from table12 select * from table2....table nthIs there a way to execute these? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-18 : 00:07:06
|
| you need to use dynamic sql for this. also a loop or cursor is reqd to traverse row by row. why are you storing statements themselves in table? |
 |
|
|
j0shua
Starting Member
40 Posts |
Posted - 2009-02-18 : 00:16:57
|
i am actually looking for a way to select a specific data in all tables from this codeSELECT 'SELECT * FROM ' + QUOTENAME(TABLE_NAME) + ' WHERE ' + QUOTENAME(COLUMN_NAME) + '=''11223344-5566-7788-99AA-BBCCDDEEFF00'''FROM INFORMATION_SCHEMA.COLUMNS c WHERE DATA_TYPE='uniqueidentifier' AND EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=c.TABLE_NAME and TABLE_TYPE='BASE TABLE') and i am looking for ways to execute these, thanks!! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-18 : 01:52:06
|
| just copy paste the result of above query into another query window and execute |
 |
|
|
|
|
|