TSQL: <3 Search all your SQL Server Databases for a Specific Table …

We’re all just searching for something …

Bigger than we’re all able to find …

Chasing all the things that keep us young …

We won’t stop running til we reach the sun …

We’re just chasing what we can’t ever get … ever have …

EXEC sp_MSforeachdb 'USE ?
IF EXISTS(SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ''YourTableName'')
BEGIN
SELECT ''?'' AS DATABASE_NAME, TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = ''YourTableName''
END'
Simple substitute your own table name into the code above and find the table you are looking for in any database on your SQL Server instance… Enjoy ❤

About AussieBICG

Connect with me here https://au.linkedin.com/in/aussiebicg

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s