Posts
1150
Comments
891
Trackbacks
1
T-SQL: finding a table

If you know the server and the table name, but not which database it is in, run this:

EXEC

Oddly, you need to run it in Query Analyzer, not SQL Management Studio as the latter will start to execute it, but will through an error before it completes (at least in my situation it does...could be the number of databases).

sp_MSForEachDB "SELECT name AS '?' FROM [?]..sysobjects where name = 'TableName'"
posted on Friday, August 04, 2006 1:42 PM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 7 and 5 and type the answer here: