Thursday, March 4, 2010

Iterating through SQL Server databases and database objects without cursors

Iterating through SQL Server databases and database objects without cursors
There are times when you need to loop through all the databases or database objects to perform some tasks. For example you want to run a DBCC command against all the databases or take backups of all the databases on the server or you want to rebuild all the indexes of all the tables in the databases or you want to know the size of each table in a database. The simplest approach would be to create a cursor and loop through it, which requires you to write several lines of code. Is there any way to simplify the coding efforts for these kind of works? Click here for more details.

No comments:

Post a Comment