Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find table name in which database 1

Status
Not open for further replies.

hokky

Technical User
Nov 9, 2006
170
AU
Hi guys,

Just quick question,

in SQL 2000
Is there any quick way to search particular table name in which database, without going to database one by one.

Because what I'm currently doing is like this
Code:
use [database name]
Select * From sysobjects Where name like '%TABLENAME%'

And I need faster way.

Thanks guys
 
You are very close, try this:

Code:
SELECT     *
FROM         sysobjects
WHERE     (name LIKE '%TABLENAME%')

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"If you have a big enough dictionary, just about everything is a word"
--Dave Barry
 
If you are just trying to find which db a table lives in then you should be able use Object search..
In Query Analyzer, Press F4, enter criteria and do 'Find Now'
 
Thanks guys,

I'll try it tomorrow
 
I also suggest you try....

Code:
sp_msforeachdb 'If Exists(Select * from [?].information_Schema.Tables Where Table_Name like ''%TABLENAME%'') Select ''?'' As DatabaseName '

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top