dcsimg
 

Run The Same SQL Command Against All Databases

Friday Jan 18th 2008 by DatabaseJournal.com Staff

There are times when I find myself needing to run a SQL command against each database on one of my SQL Server instances. There is a handy undocumented stored procedure that allows you to do this...

[From MSSQLTips]

There are times when I find myself needing to run a SQL command against each database on one of my SQL Server instances. There is a handy undocumented stored procedure that allows you to do this without needing to set up a cursor against your sysdatabases table in the master database: sp_MSforeachdb.

The article continues at http://www.mssqltips.com/tip.asp?tip=1414

Home
Mobile Site | Full Site