SA0193 : Avoid unused labels to improve readability |
![]() |
The topic describes the SA0193 analysis rule.

Avoid unused labels to improve readability

The rule code and reports the unused labels.
The labels, which are declared, but not used should be removed in order to improve maintainability and avoid confusion about what is the label meant for.

Remove the unused labels.

The rule has a Batch scope and is applied only on the SQL script.

Rule has no parameters.

The rule does not need Analysis Context or SQL Connection.


Design Rules, Code Smells

There is no additional info for this rule.

SQL
1DECLARE @Counter int; 2SET @Counter = 1; 3WHILE @Counter < 10 4BEGIN 5 SELECT @Counter 6 SET @Counter = @Counter + 1 7 IF @Counter = 4 GOTO Branch_One -- Jumps to the first branch. 8 -- IF @Counter = 5 GOTO Branch_Two -- This will never execute. 9END 10Branch_One: 11 SELECT 'Jumping To Branch One.' 12 GOTO Branch_Three; --This will prevent Branch_Two from executing. 13Branch_Two: 14 SELECT 'Jumping To Branch Two.' 15Branch_Three: 16 SELECT 'Jumping To Branch Three.' |

Message | Line | Column | |
---|---|---|---|
1 | SA0193 : Avoid unused labels to improve readability. | 13 | 0 |
