Avoiding Cursors with SQL Server 2005

Monday Jul 21st 2008 by DatabaseJournal.com Staff
Share:

Sometimes cursors are necessary when executing queries in SQL Server, but most of the time they can be avoided entirely. Tim Chapman shows where cursors can traditionally be used, and how you can use features packaged in SQL Server 2005 to avoid them.

[From TechRepublic]

How necessary are the use of cursors in SQL Server? In a previous article I showed you how you could write your own custom procedures to loop through a collection of objects, such as tables or databases, and execute statements against those objects. That article used cursors exclusively to loop through the objects. Sometimes cursors are necessary, especially when executing stored procedures against separate records in a SQL Server table. However, when it comes to using queries to return result sets, most of the time cursors can be avoided entirely. Today I am going to look at tricky problem where cursors would traditionally be used, and how you can use features packaged in SQL Server 2005 to avoid them.

The article continues at http://blogs.techrepublic.com.com/datacenter/?p=412

Share:
Home
Mobile Site | Full Site
Copyright 2017 © QuinStreet Inc. All Rights Reserved