Purpose:
execute up to three commands for every database on the system. @replacechar will be replaced with the name of each database. @precommand and @postcommand can be used to direct commands to a single result set.
Example:
EXEC sp_MSforeachdb @command1 = 'Print "Listing ?=', @command2 = 'SELECT * FORM ?', @whereand = ' AND name like "title%"'
-From the Gurus's Guide to Transact-SQL by Ken Henderson
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.