Click here to Skip to main content
15,886,873 members
Articles / Database Development / SQL Server
Alternative
Tip/Trick

Always close your cursor

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
18 Oct 2011CPOL 5.6K   1  
You also might want to look into the "LOCAL" keyword.This limits the scope of the cursor to the context in which it is created.DECLARE IdCursor CURSOR LOCAL FOR SELECT Id FROM MyTableThis is beneficial for many reasons.
You also might want to look into the "LOCAL" keyword.
This limits the scope of the cursor to the context in which it is created.

SQL
DECLARE IdCursor CURSOR LOCAL FOR SELECT Id FROM MyTable


This is beneficial for many reasons.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Netherlands Netherlands
Doing that 'computer thing' ever since the C64.

Sometimes I feel that being a programmer is much like being a doctor: You just have to know everything and if you don't, something dies.

Either being an application or a patient.

Oddly enough, more people care about the death of their application, than the massacre of people...

Comments and Discussions

 
-- There are no messages in this forum --