Create a cursor

DECLARE @au_id varchar (11), @ au_fname varchar (20) - declare variable
- a cursor affirmed
the DECLARE CURSOR the FOR authors_cursor
the SELECT the au_id, the authors au_fname the FROM
- a cursor open
the OPEN authors_cursor
- takes a value
FETCH NEXT FROM authors_cursor INTO @au_id , @au_fname
- extraction cycle values of the cursor
the WHILE @@ = 0 FETCH_STATUS
the BEGIN
the Print @au_id
the Print @au_fname
the Print ''
the FETCH the NEXT the FROM authors_cursor
the INTO @au_id, @au_fname
the END
the CLOSE authors_cursor - close a cursor
DEALLOCATE authors_cursor - releases the puck

Guess you like

Origin www.cnblogs.com/missheyo/p/11237602.html