Created
March 16, 2012 12:01
-
-
Save mdnmdn/2049776 to your computer and use it in GitHub Desktop.
TSQL Cursor definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @_id int | |
DECLARE CUR CURSOR FOR | |
select id from table_name | |
OPEN CUR; | |
FETCH NEXT FROM CUR into @_id; | |
WHILE @@FETCH_STATUS = 0 | |
BEGIN | |
PRINT cast(@_id as varchar) | |
FETCH NEXT FROM CUR into @_id; | |
END | |
CLOSE CUR | |
DEALLOCATE CUR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment