The label ‘%.*ls’ has already been declared. Label names must be unique within a query batch or stored procedure.

Error Message:
Msg 132, Level 15, State 1, Line 11
The label ‘%.*ls’ has already been declared. Label names must be unique within a query batch or stored procedure
.

Severity level:
15.

Description:
This error message appears when you try to specify a label more than once.

Consequences:
The SQL statement cannot be parsed and further execution is stopped.

Resolution:
Error of the Severity level 15 are generated by the user and can be fixed by the SQL Server user. The GOTO labels within a batch or a stored procedure must be unique.

Versions:
All versions of SQL Server.

Example(s):
USE tempdb;
GO
DECLARE @i int;
SET @i = 1;
WHILE @i < 10
BEGIN
 SELECT @i
 SET @i = @i + 1
 IF @i = 4 GOTO Branch_1
END
Branch_1:
 SELECT ‘This is Branch_1.’
Branch_1:
 SELECT ‘This is Branch_1.’

Remarks:
In the above example we try to declare the label Branch_1 more than once. This raises the error.




Related Articles :

  • No Related Articles Found

One Response to “The label ‘%.*ls’ has already been declared. Label names must be unique within a query batch or stored procedure.”

  1. i am tring to add google analytical code but i afce error

    Incorrect syntax near ‘_setAccount’.
    The label ‘https’ has already been declared. Label names must be unique within a query batch or stored procedure.

    how i recover with that problem..

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |