Hi all
I am trying to use cursors in a database procedure, here is the cursor code that I am using:
However I am getting the following error:
Incorrect syntax near the keyword current
Any suggestions.
Mike55
I am trying to use cursors in a database procedure, here is the cursor code that I am using:
Code:
DECLARE Manager_Cursor CURSOR FOR
SELECT Manager_ID FROM Managers WHERE Org_ID = @OrgID
OPEN Manager_Cursor;
FETCH NEXT FROM Manager_Cursor;
WHILE @@FETCH_STATUS = 0
BEGIN
DELETE FROM Groups_Reference
WHERE Manager_ID = CURRENT OF Manager_Cursor
FETCH NEXT FROM Manager_Cursor;
END
CLOSE Manager_Cursor;
DEALLOCATE Manager_Cursor;
However I am getting the following error:
Incorrect syntax near the keyword current
Any suggestions.
Mike55