A clean, almost empty, sql cursor example
Would be a lot better if you'd have a query, select it, right click, and "surround with: cursor" :)
But cannot be done just yet
DECLARE @CPilot INT
DECLARE cursorServProvDefServ CURSOR FOR
SELECT Company
FROM Company
OPEN cursorServProvDefServ
FETCH NEXT FROM cursorServProvDefServ INTO @CPilot
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @CPilot
FETCH NEXT FROM cursorServProvDefServ INTO @CPilot
END --while @@FETCH_STATUS = 0
CLOSE cursorServProvDefServ
DEALLOCATE cursorServProvDefServ
No comments:
Post a Comment