Click here to Skip to main content
Click here to Skip to main content

Always close your cursor

By , 18 Oct 2011
 
To see the default value of the cursor scope:
 
select * from sys.databases
(if value of "is_local_cursor_default" is 0 then scope id global, otherwise it is local).
The scope is GLOBAL by default (for compatibility reasons).
To change default scope use following:
ALTER DATABASE [YourDatabase] SET CURSOR_DEFAULT LOCAL; 

License

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

About the Author

Elina Blank
Software Developer (Senior) The Code Project
United States United States
Member
Elina joined the Code Project team as a software developer in order to make the site run even smoother than it is now. She will also take care of making wishes and promises on the site improvements come to the light sooner than later. When not at work, she enjoys being with her family and wishes there will be at least 30 hours in a day Smile | :)

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralReason for my vote of 5 Great tip.memberKabwla.Phone18 Oct '11 - 22:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 18 Oct 2011
Article Copyright 2011 by Elina Blank
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid