Also check out undocumented stored procedures at: http://www.mssqlcity.com/Articles/Un...000UndocSP.htm
Sometimes, you need to perform the same actions for all tables in the database. You can create cursor for this purpose, or you can also use the sp_MSforeachtable stored procedure to accomplish the same goal with less work.
For example, you can use the sp_MSforeachtable stored procedure to rebuild all the indexes in a database:
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"
Database Developer / Software Engineer
WISHA/Legal Services Software Development
Department of Labor and Industries
Voice (360) 902-5928 fax (360) 902-6200