Msg 16955 – Could not create an acceptable cursor

06 March,2018 by Jack Vamvas

 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

 


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

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.

Working...

Post a comment on Msg 16955 – Could not create an acceptable cursor


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer