|
|
| |

How do I perform the same actions for all databases?
Answer:
If you need to perform the same actions for all databases, you can
create cursor or you can use the sp_MSforeachdb undocumented
stored procedure to accomplish the same goal with less work.
For example, you can use the sp_MSforeachdb stored procedure
to run the DBCC CHECKDB statement for all the databases on your server:
EXEC sp_MSforeachdb @command1="print '?' DBCC CHECKDB ('?')"
See also these links:
SQL Server 2000 Useful undocumented stored procedures
SQL Server 7.0 Useful undocumented stored procedures
|
|
|