The use of the SQL Midstream label

Source: Internet
Author: User

DECLARE @id int
DECLARE @addTime datetime
Declare cursor1 cursor for--defines a cursor Cursor1
Select Id,addtime from Mr_examine--object with cursor (fill in select text as required)
Open Cursor1--opening cursors
DECLARE @i int
Set @i=1
FETCH NEXT from the Cursor1 into @id, @addTime--moves the cursor down by 1 rows, gets the data into the previously defined variable @id, @name


While @ @fetch_status = 0--Determine if the data was successfully obtained
Begin
if (@i>10)
Set @i=1

Update Mr_examine Set Addtime=dateadd (Day,@i*-1,getdate ()) Where [email protected]-do the appropriate processing (as required Fill in the SQL text)
Set @[email protected]+1
FETCH NEXT from Cursor1 into @id, @addTime--Move cursor down 1 rows
End
Close Cursor1--closing cursors
Deallocate Cursor1

The use of the SQL Midstream label

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.