SQL Server Database cursor options

Source: Internet
Author: User

Background:

Cursors control the behavior of server-side cursors, with the associated T-SQL as follows:

Declare, open, Fetch, close, deallocate.

1.

Cursor_close_on_commit{on | off};

If set to on closes the open cursor when the transaction commits or rolls back,

If set to OFF, the cursor will continue to open after the transaction is committed, unless the cursor is defined as static and the rollback transaction closes any cursors.

ALTER DATABASE Studio
set CURSOR_CLOSE_ON_COMMIT on; # you can see there's no = number here! Remember
Go

2.

Cursor_default {local | global}

If set to local does not designate the cursor as global when it is defined, it is scoped only to the batch, stored procedure, and trigger in which it resides.

If set to global does not specify the cursor as local when it is defined, it is global.

ALTER DATABASE Studio
set Cursor_default local; # You can see there's no = number here! Remember
Go

-----------------------------------------------------------------------------------------------------

SQL Server Database cursor options

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.