October 24, 2001 10:24 PM

Sequential to Set-Based

Rating: (0)
SQL Server Magazine
InstantDoc ID #22431
Forget cursors and get with set-based programming
Editor's Note: Send your experts-only T-SQL tips to Itzik Ben-Gan at blackbelt@sqlmag.com. If we use your tip in the magazine, you'll receive $100 and an exclusive T-SQL Black Belt shirt.

Programmers who have experience in sequential file processing, for example with COBOL, can encounter difficulty when they start programming in a relational environment such as SQL Server. Such programmers often try to solv...

...This article is for paid Professional Members only.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Professional Membership

Monthly

Annual

VIP Membership

Monthly

Annual

Add a Comment

I recently changed a T-SQL routine that used cursors to one that used five SQL statements, using the set-based concept. I reduced my runtime from 27 hours to 30 minutes. One of my cursors had 5 million rows, which were being compared to
4 million table records. Though the table was indexed, I looped through my cursor one record at a time and performed my comparisons (I'm from the old school). But now, cursors and I have split the sheets.
- BW

FERNANDO10/26/2001 12:34:52 PM


You must log on before posting a comment.

Are you a new visitor? Register Here
GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS