Home » SQL Server Error : 16915, Severity: 16. A cursor with the name ‘%.*ls’ already e

SQL Server Error : 16915, Severity: 16. A cursor with the name ‘%.*ls’ already e

SQL Server Error : 16915 Details


SQL Server Error: 16915
Severity: 16
Event Logged or not: No
Description:
A cursor with the name ‘%.*ls’ already exists.
Severity 16 Description:
Indicates general errors that can be corrected by the user.

Msg 16915, Level 16, State 1, Procedure client_myClientsProc, Line 46
A cursor with the name ‘cur_keywords’ already exists.
Msg 16905, Level 16, State 1, Procedure client_myClientsProc, Line 47
The cursor is already open.

Reading sql server error log location from SQL Query

Identifying SQL Server Error Log File used by SQL Server Database Engine can be done by reading SQL Server Error Logs. DBA can execute the XP_READERRORLOG extended stored procedure to read the SQL Server Error Log and search for its location used by the instance of SQL Server.

USE master
Go
xp_readerrorlog 0, 1, N'Logging SQL Server messages in file', NULL, NULL, N'asc'
Go

For other ways to read and find error log location please our article https://sqlserver-dba.co.uk/error-log/sql-server-identify-location-of-the-sql-server-error-log-file.html

Solution for Resolving the Error

Is the error encountered during running Stored procedure? Did the saved procedure previously fail?

It can be because there is no TRY…Catch, it appears that the CLOSE and DEALLOCATE instructions were not executed. This may happen if the code encountered a mistake. To ensure that the cursor has been correctly wiped off, use CATCH in your code or another approach. Try disconnecting and reconnecting (or manually running CLOSE and DEALLOCATE in the same connection).

The second inaccuracy is most likely due to a lack of clean-up. If a temporary table already exists when you run the stored method, the code DROPs it. However, the CREATE is in the ELSE section of that statement. If the table already exists, it will be DROPPETED and will not be rebuilt.

SQL Server Error Code and solution summary


SQL Server Error: 16915
Severity: 16
Event Logged or not: No
Description:
A cursor with the name ‘%.*ls’ already exists.

Leave a Reply

Your email address will not be published.