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 |
|
mukkanti
Starting Member
9 Posts |
Posted - 2008-06-12 : 05:08:27
|
| All, i am looking for a query which fetches data from column 'managerid' which spread across 20 tables,Managerid colums is spread across 20 tables and i need only managerid data from all the tables available, data for managerid column will be different in each table.can anyone help me regarding the same. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-12 : 05:16:17
|
Exec sp_msforeachtable 'if col_length(''?'',''Managerid'')>0 SELECT Managerid FROM ?'or useSELECT managerid from table1UNION ALLSELECT mangerid FROM Table2....UNION ALLSELECT mangerid from Table20 |
 |
|
|
mukkanti
Starting Member
9 Posts |
Posted - 2008-06-12 : 05:33:28
|
| Hi, Thanks , i got the data. |
 |
|
|
|
|
|