Categories: SQL Server

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.

VRB

Recent Posts

sql server detected logical consistency based error

Learn about SQL Server detecting logical consistency based issues and how to resolve them.

5 months ago

sql server error 1222

Learn about SQL Server error 1222 and how to resolve the lock request time out…

6 months ago

Microsoft SQL Server 2022 New Features

Discover the new features of Microsoft SQL Server 2022 and how they compare to previous…

6 months ago

SQL Server Error 1222 lock request time out period exceeded

SQL Server Error 1222 lock request time out period exceeded   Lock request time out…

6 months ago

SQL Server Error : 427, Severity: 20. Could not load the definition for constr

SQL Server Error : 427, Severity: 20. Could not load the definition for constraint ID…

11 months ago

SQL Server Error : 204, Severity: 20. Normalization error in node %ls.

SQL Server Error : 204, Severity: 20. Normalization error in node %ls.

11 months ago

This website uses cookies.