You would have to insert the returned record into a temp table or table variable inside the cursor
It sounds like you should be able to combine this into a single query. If you provide your queries I'll see if you can do this without a CURSOR which would save a lot of processing time...CURSORs are evil.
Main Topics
Browse All Topics





by: chapmandewPosted on 2008-03-07 at 13:06:57ID: 21074137
cursor should look something like this:
DECLARE @ID INT
DECLARE CursorTemplate CURSOR
FAST_FORWARD FOR
SELECT ID FROM Table1
OPEN CursorTemplate
SET @InCursor = 1
FETCH NEXT FROM CursorTemplate
INTO @ID
WHILE (@@FETCH_STATUS = 0)
BEGIN
SELECT * FROM Table2
WHERE Field = @ID
FETCH NEXT FROM CursorTemplate
INTO @ID
END
CLOSE CursorTemplate
DEALLOCATE CursorTemplate