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 |
|
Babli
Yak Posting Veteran
53 Posts |
Posted - 2011-08-26 : 01:16:12
|
| Hi,I have the name of a table , i want to find out all the database names in which this table resides.How can I query all the databases in a server for this table. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-26 : 01:44:56
|
| [code]EXEC sp_Msforeachdb 'IF EXISTS(SELECT 1 FROM ?.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ''your table name here'' AND TABLE_TYPE=''BASE TABLE'') SELECT ''?'''[/code]will give you names of all dbs where table is present------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|