34,590
社区成员
发帖
与我相关
我的任务
分享
DECLARE @cursor INT
DECLARE @rowcount INT
EXEC sp_cursoropen @cursor OUTPUT, N'SELECT * FROM customers where cust_id=@id', 2, 8193, @rowcount output, N'@id', @id=10
EXEC sp_cursorclose @cursor
DECLARE @cursor INT
DECLARE @rowcount INT
EXEC sp_cursoropen @cursor OUTPUT
, N'SELECT * FROM t2 where a=@id'
, 135170--4098
, 8193
, @rowcount output
,N'@id int'
,@id=2
EXEC sp_cursorfetch @cursor, 2, 0, 3
EXEC sp_cursorclose @cursor
/*
a b
----------- -----------
a b
----------- -----------
2 6
*/
DECLARE @cursor INT
DECLARE @rowcount INT
EXEC sp_cursoropen @cursor OUTPUT
, N'SELECT * FROM t2 where a=@id'
, 4098
, 8193
, @rowcount output
,N'@id int'
,@id=2
EXEC sp_cursorfetch @cursor, 2, 0, 3
EXEC sp_cursorclose @cursor
/*
a b
----------- -----------
a b
----------- -----------
2 6
*/
DECLARE @cursor INT
DECLARE @rowcount INT
EXEC sp_cursoropen @cursor OUTPUT
, N'SELECT * FROM t2 where a=@id'
, 135170
, 8193
, @rowcount output
,N'@id int'
,@id=8
EXEC sp_cursorclose @cursor
DECLARE @cursor INT
DECLARE @rowcount INT
EXEC sp_cursoropen @cursor=@cursor OUTPUT
,@paramdef=N'@id int'
,@id=10
,@stmt=N'SELECT * FROM ta where id=@id'
,@scrollopt=2
,@ccopt=8193
,@rowcount=@rowcount output
EXEC sp_cursorclose @cursor
/*
消息 16902,级别 16,状态 24,过程 sp_cursoropen,第 1 行
sp_cursoropen: 参数 'scrollopt' 的值无效。
*/