Compiles the cursor statement or batch into an execution plan, but does not create the cursor. The compiled statement can later be used by sp_cursorexecute. This procedure, coupled with sp_cursorexecute, has the same function as sp_cursoropen, but is split into two phases. sp_cursorprepare is invoked by specifying ID = 3 in a tabular data stream (TDS) packet.
A SQL Server-generated prepared handle identifier that returns an integer value.
prepared_handle is subsequently supplied to a sp_cursorexecute procedure in order to open a cursor. Once a handle is created, it exists until you log off or until you explicitly remove it through a sp_cursorunprepare procedure.
Identifies parameterized statements. The params definition of variables is substituted for parameter markers in the statement. params is a required parameter that calls for an ntext, nchar, or nvarchar input value. Input a NULL value if the statement is not parameterized.
Use an ntext string as the input value when stmt is parameterized and the scrollopt PARAMETERIZED_STMT value is ON.
Defines the cursor result set. The stmt parameter is required and calls for an ntext, nchar or nvarchar input value.
The rules for specifying the stmt value are the same as those for sp_cursoropen, with the exception that the stmt string data type must be ntext.
An optional parameter that returns a description of the cursor result set columns. options requires the following int input value.
Scroll Option. scrollopt is an optional parameter that requires one of the following int input values.
Because the requested value might not be appropriate for the cursor defined by stmt, this parameter serves as both input and output. In such cases, SQL Server assigns an appropriate value.
Concurrency control option. ccopt is an optional parameter that requires one of the following int input values.
SCROLL_LOCKS (previously known as LOCKCC)
OPTIMISTIC (previously known as OPTCC)
OPTIMISTIC (previously known as OPTCCVAL)
As with scrollpt, SQL Server can assign a different value from the one requested.