2014-09-29 151 views
0

我有一个代码,当程序用户登录:SQL:sp_cursorexecute执行错误

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/> 

其完整的错误:

Msg 16902, Level 16, State 20, Procedure sp_cursorprepexec, Line 1 sp_cursorprepexec: The value of the parameter 'scrollopt' is invalid.

做一些人知道,怎么解决呢?

回答

2

注释掉@ p1和@ p2的设置,并设置@ p5 = 4097.
如果这不是拼写错误,也可以在最后取出html换行符。

我把它看成是在配置文件/跟踪结果,在RPC:已完成。找到匹配(通过SPID)RPC:开始,这应该执行没有任何编辑。

+0

我不得不将RPC:Starting选项添加到跟踪事件选择中以找到它,但是一旦我做了,我可以在未修改的MSSMS中执行查询 – 2015-05-05 02:36:26