From: http://www.databasejournal.com/features/mssql/article.php/1490661
sp_MSforeachtable
By Brian Knight
Is there such a thing as a task where you would not need a cursor? Hidden in the depths of the Master database are a series of stored procedures that can replace some cursors with these one-liners.
Traditionally if you wanted to run a DBCC CHECKTABLE on every table in a database you’d [...]
Filed under: SQL Server | Tagged: query, sp, sql, storedprocedure, tables | Leave a Comment »