Difference between revisions of "How to locate a table by table name"
From MyWiki
(Created page with "<source lang="sql"> create table #t ( DBName sysname not null ) go exec sp_msforeachdb 'use [?]; if OBJECT_ID(''dbo.staff'') is not null insert into #t (DBName) select ''?...") |
(No difference)
|
Latest revision as of 17:06, 29 January 2016
CREATE TABLE #t ( DBName sysname NOT NULL ) GO EXEC sp_msforeachdb 'use [?]; if OBJECT_ID(''dbo.staff'') is not null insert into #t (DBName) select ''?''' GO SELECT * FROM #t GO DROP TABLE #t