March 3, 2008 at 6:40 am
You'll have to walk through the databases on the server. Try something like this. It'll work, but it's not perfect.
sp_msforeachdb 'select DB_NAME() AS ''DBName''
FROM INFORMATION_SCHEMA.TABLES t
WHERE t.TABLE_NAME = ''Customer'''
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
March 3, 2008 at 6:41 am
You should use the foreachdatabase.
EXEC master..sp_MSForeachdb '
USE [?]
IF DB_ID(''?'')>4
BEGIN
IF EXISTS(SELECT 1
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = ''Customer'')
BEGIN
PRINT ''?''
END
END
'
March 3, 2008 at 6:42 am
Same concept but a little different twist.
March 3, 2008 at 6:43 am
Yeah, always more than one way to skin a cat.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 4 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply