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
 General SQL Server Forums
 New to SQL Server Programming
 tables exist in which database

Author  Topic 

paritosh
Starting Member

42 Posts

Posted - 2011-09-15 : 08:21:45

how to find table where exist in all database

finding table in whole database.

please give suitable logic and query .

flamblaster
Constraint Violating Yak Guru

384 Posts

Posted - 2011-09-15 : 09:33:39
Could you maybe provide a bit more information?

You could run:

SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='TableYouAreSearchingFor'

Without more information, it is difficult to know what you're trying to do.
Go to Top of Page

paritosh
Starting Member

42 Posts

Posted - 2011-09-16 : 06:48:20

i want to know how . suppose we have 10 databases .if i want which database contain
table 'abc' .

without execute query 10 times . only single effort give the result what is logic we apply
please give answer..
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-09-16 : 07:12:35

This is undocumented

exec sp_msforeachdb 'if exists(select * from ?.sys.objects where name=''table_name'') select ''?'''


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -