The following insights are diaries that are made during the process of using cursors. I am also the first time to use, if there is something wrong, please criticize, we work together.
1.
Msg 16951, Level 16, State 1, procedure Usp_proc, line 16th
The variable ' @myref ' cannot be used as a parameter because the cursor OUTPUT parameter must not be assigned cursors until the procedure is executed.
The problem is that I'm calling a recursive, output cursor with a stored procedure
Create procUsp_proc (@level int@myref cursor varyingoutput) asbegin if @level=3 begin Set @myref=cursorLocal static for Select * from Table Open @myref End if @level<3 begin Declare @cur cursor execUsp_proc2 @curOutput--Recursive -- --do some operation on the @cur of the travel Mark -- --using the cursor out Close @cur --Close Cursors deallocate @cur --Delete Cursor EndEnd
The above error occurs if there is no close, deallocate processing of the output cursor.
Errors that occur during SQL Server's use of cursors