06 March,2018 by Tom Collins
Question: I’m getting an error when checking some new application installed with a SQL Server backend. How can I fix? The sql code and the associated error are below:
declare @p1 int set @p1=0 declare @p3 int set @p3=98305 declare @p4 int set @p4=311300 declare @p5 int set @p5=0 exec sp_cursoropen @p1 output,N'SELECT GetDate()',@p3 output,@p4 output,@p5 output select @p1, @p3, @p4, @p5 Msg 16955, Level 16, State 2, Line 10 Could not create an acceptable cursor. Msg 16945, Level 16, State 2, Procedure sp_cursoropen, Line 1 [Batch Start Line 9] The cursor was not declared.
Answer: This error is occurring because the parameters defined mean a dynamic cursor. I’ve substituted the scroll – options (@p2) to static or forward-only and the concurrency option (@p4) to read-only and the error message disappears. I’d recommend you pass the code back to the developer with this information and they can work on a long-term fix
To further understand the problem – the exec sp_cursoropen is defining the SQL code relating to the cursor and the cursor options. The sp_cursoropen is similar to DECLARE_CURSOR and OPEN when managing cursors through t-sql
Read more about SQL Server – Troubleshoot open cursors with sys.dm_exec_cursors
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |