SA0182 : The CASE expressions is missing ELSE clause
The topic describes the SA0182 analysis rule.
The CASE expressions is missing ELSE clause
The rule reports CASE expressions, which are missing ELSE clause.
In terms of defensive programming the ELSE clause should either have a default action or contain a comment explaining the reason an action is not taken.
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.
There is no additional info for this rule.
1Declare @x int = 5 2DECLARE @y int = CONVERT(int, RAND()*@x) 3 4select CASE @x 5WHEN 1 THEN 'a' 6WHEN 2 THEN 'b' 7ELSE 'c' 8end 9 10select CASE CONVERT(int, RAND()*@y) 11WHEN 1 THEN 'a' 12WHEN 2 THEN 'b' 13end
|1||SA0182 : The CASE expressions is missing ELSE clause.||10||7|
© Ubitsoft Ltd. All Rights Reserved.