Created
February 16, 2015 03:36
-
-
Save tjklemz/f9a5ef72c6d4c3d81b2d to your computer and use it in GitHub Desktop.
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, @Title VARCHAR(50) | |
DECLARE Iterator CURSOR FORWARD_ONLY FOR | |
SELECT Id, Title FROM dbo.SourceTable | |
OPEN Iterator | |
WHILE 1=1 BEGIN | |
FETCH NEXT FROM @InputTable INTO @Id, @Title | |
IF @@FETCH_STATUS < 0 BREAK | |
PRINT 'Do something with ' + @Title | |
END | |
CLOSE Iterator | |
DEALLOCATE Iterator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment