Skip to content

Instantly share code, notes, and snippets.

@andyj
Created October 26, 2015 22:29
Show Gist options
  • Save andyj/653b74ce491dc33dd9a0 to your computer and use it in GitHub Desktop.
Save andyj/653b74ce491dc33dd9a0 to your computer and use it in GitHub Desktop.
Search all MSSQL databases on a server for a table
sp_MSforeachdb 'SELECT "?" AS DB, * FROM [?].sys.tables WHERE name like ''%tableNameYouAreSearchingFor%'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment