Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tsql:cursors [2017/07/21 21:47]
127.0.0.1 external edit
tsql:cursors [2019/04/04 17:16] (current)
dyson
Line 29: Line 29:
  
 The ''​nextrow''​ label allows you to use ''​GOTO nextRow''​ in the ''​WHILE''​ body to achieve a ''​CONTINUE''​ effect without omitting to ''​FETCH NEXT''​. The ''​nextrow''​ label allows you to use ''​GOTO nextRow''​ in the ''​WHILE''​ body to achieve a ''​CONTINUE''​ effect without omitting to ''​FETCH NEXT''​.
 +
 +===== Uncommented =====
 +
 +<code tsql>​DECLARE _myCursor CURSOR LOCAL FOR
 +  SELECT statement
 + 
 +OPEN _myCursor ​
 +FETCH NEXT FROM _myCursor INTO variableList
 + 
 +WHILE @@FETCH_STATUS = 0
 +BEGIN
 + 
 +
 +
 +  FETCH NEXT FROM _myCursor INTO variableList
 +
 +END
 + 
 +CLOSE _myCursor ​
 +DEALLOCATE _myCursor </​code>​
  
 {{tag> tsql development}} {{tag> tsql development}}
 ~~DISCUSSION~~ ~~DISCUSSION~~