DF088: Code contains an unused label.

The topic describes the DF088 T-SQL code analysis rule.

Category

STYLE

Message

Code contains an unused label.

Description

To improve code maintainability and avoid confusion, it is recommended to remove labels, which are declared, but not used.

Additional information

Unused labels serve no purpose and can mislead others into thinking that they are relevant to the code’s functionality. Removing such labels helps streamline the code, making it cleaner, easier to understand, and less prone to errors.

Noncompliant code example

CREATE OR ALTER PROCEDURE dbo.DemoProcedure
AS
BEGIN
  SELECT
    *
  FROM dbo.DemoTable
ExitLabel:
END
GO

Compliant solution

CREATE OR ALTER PROCEDURE dbo.DemoProcedure
AS
BEGIN
  SELECT
    *
  FROM dbo.DemoTable
END
GO