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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Searching Specific tables within a Server

Author  Topic 

DiceK-BadMan
Starting Member

12 Posts

Posted - 2007-11-01 : 17:38:00
Hello...

I'm trying to figure out how can I make a query of finding a specific table within a server that has a hundreds of database..

I know its to simple too answer but I'm curious..

Thanks for helping me...

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-11-01 : 17:55:01
[code]
DECLARE @sql NVARCHAR(500), @tableName NVARCHAR(128)
SELECT @tableName = '%Address%',
@sql = 'use ?; select * from Information_schema.tables where table_name like ''' + @tableName + ''''

exec sp_MsForEachDb @sql
[/code]



_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

DiceK-BadMan
Starting Member

12 Posts

Posted - 2007-11-01 : 17:57:45
Thanks for the code spirit1..

Go to Top of Page

Jeff Moden
Aged Yak Warrior

652 Posts

Posted - 2007-11-02 : 00:02:55
Or, in Query Analyzer, press the {f4} key.

--Jeff Moden
Go to Top of Page
   

- Advertisement -