Tag Archives: sp_msforeachdb

Find the Database where specific Procedure/table exists in a given SQL instance

This script is used to find the database in which a specific procedure or a table name exists. Few of my developers share just a procedure name or table name for analysis but it used to be hard to find … Continue reading

Posted in Productivity, SQL, SQL Query | Tagged , , | Leave a comment

Run query on multiple databases or tables sp_msforeachdb or sp_msforeachtable

I had been using sp_msforeachdb for long to search any object (table, column, Procedure, etc) on a given SQL instance. I come across similar SP sp_msforeachtable which can be used to run against all tables. Example:

Posted in SQL, SQL Query | Tagged , , , , , , | 2 Comments