Home

Expressions should not be too complex

Rule description

  • Expressions should not be too complex

 

Non-compliant Code Example

DECLARE @id int;
DECLARE @Number1 int; 
DECLARE @Number2 int; 
DECLARE @Number3 int; 
DECLARE @Number4 int; 

SET @Number1 = 50;  
SET @Number2 = 150;  
SET @Number3 = 500;  
SET @Number4 = 950;  

IF (@Number4 > 100 and @Number1 < 100) AND
        (@Number2 > 100 and @Number3 < 400) OR
        (@Number4 > 100 and @Number2 < 200)  --Non compliant code
    Select * From Employee Where id < @id;
    PRINT 'The number is less then 100.';
Visual Expert 2020
 VETSQLRULE66