sys.sp_cursorprepexec
general #stored-procedure
Description
Analytics Platform System (PDW) Compiles a plan for the submitted cursor statement or batch, then creates and populates the This procedure is invoked by specifying in a tabular data stream (TDS) packet.
Syntax
sp_cursorprepexec prepared handle
OUTPUT
, cursor
OUTPUT
, params , statement ,
options
[ , scrollopt [ , ccopt [ , rowcount ] ] ]
[ ,
'@parameter_name [ ,.n ]'
]
Examples
Example 1
sp_cursorprepexec
Example 2
Person
Example 3
AdventureWorks2025
Example 4
USE
AdventureWorks2022;
GO
DECLARE
@prep_handle
INT
,
@
cursor
INT
,
@scrollopt
INT
= 4104,
@ccopt
INT
= 8193,
@rowcnt
INT
;
EXECUTE sp_cursorprepexec
@prep_handle
OUTPUT
,
@
cursor
OUTPUT
,
N
'@fName nvarchar(100)'
,
N
'SELECT FirstName, LastName FROM Person.Person WHERE FirstName = @fName'
,
@scrollopt,
@ccopt,
@rowcnt
OUTPUT
,
'Kirby'
;
EXECUTE sp_cursorfetch @
cursor
;