Click here to Skip to main content
15,867,834 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 (3 votes)
18 Oct 2011CPOL 10.4K   1   2
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...
To see the default value of the cursor scope:

SQL
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:
SQL
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)


Written By
Software Developer (Senior) The Code Project
United States United States
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 | :)

Comments and Discussions

 
GeneralMy vote of 5 Pin
leiyangge26-Jun-13 21:14
leiyangge26-Jun-13 21:14 
GeneralReason for my vote of 5 Great tip. Pin
Kabwla.Phone18-Oct-11 22:09
Kabwla.Phone18-Oct-11 22:09 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.