How SQL Server 2000 cursors are used

Source: Internet
Author: User
server| Cursors
How to use cursors:
Use DB1
Declare my_cursor cursor Scroll dynamic/*scroll indicates that cursor pointers can be moved at will (otherwise only forward), and dynamic means that cursors can be read or written (otherwise cursors are read-only).
For
Select name from personal data

Open My_cursor
declare @name sysname
FETCH NEXT from My_cursor into @name
while (@ @fetch_status =0)
Begin
print ' name: ' + @name
FETCH NEXT from My_cursor into @name
End
Fetch the my_cursor into @name
Print @name
/* Update personal data set name = ' Zzg ' WHERE CURRENT of my_cursor * *
/* Delete from profile WHERE CURRENT of My_cursor * *
Close My_cursor
Deallocate my_cursor
Body


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.