【问题标题】:sql: sp_cursorexecute execute errorsql: sp_cursorexecute 执行错误
【发布时间】:2014-09-29 14:06:54
【问题描述】:

当用户登录程序时,我有下一个代码:

declare @p1 int
set @p1=1073741826
declare @p2 int
set @p2=180150003
declare @p5 int
set @p5=1
declare @p6 int
set @p6=8
declare @p7 int
set @p7=1
exec sp_cursorprepexec @p1 output,@p2 output,N'@P1 varchar(30)',N'
SELECT  US_WarningFlag, datediff(day, ISNULL(US_LastPassChange, convert(datetime, ''1900-01-01'',
 120)), GetDate()), ISNULL(US_PassExpireTime, -1), US_PassMinLength
FROM    dbo.UserList    
WHERE   US_UserID = @P1',@p5 output,@p6 output,@p7 output,'Userlogin'
select @p1, @p2, @p5, @p6, @p7<br/>

完成但有错误:

消息 16902,级别 16,状态 20,过程 sp_cursorprepexec,第 1 行 sp_cursorprepexec: 参数“scrollopt”的值无效。

有人知道,如何解决?

【问题讨论】:

    标签: sql-server tsql stored-procedures execution


    【解决方案1】:

    注释掉@p1和@p2的设置,设置@p5 = 4097。
    如果那不是错字,还要去掉最后的 html 换行符。

    我认为您正在查看 RPC:Completed 上的配置文件/跟踪结果。找到匹配的(通过 SPID)RPC:正在启动,这应该无需任何编辑即可执行。

    【讨论】:

    • 我必须将 RPC:Starting 选项添加到跟踪事件选择中才能找到它,但是一旦我这样做了,我就可以在未修改的 MSSMS 中执行查询
    猜你喜欢
    • 1970-01-01
    • 2015-07-08
    • 2023-03-04
    • 2017-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多