Home

Multiline blocks should be enclosed in BEGIN...END blocks

Rule description

  • Multiline blocks should be enclosed in BEGIN...END blocks

 

Non-compliant Code Example

IF (@Number > 10) --Non compliant code (Multi-line blocks are not enclosed in the BEGIN ... END blocks.)
    BEGIN
        EXEC GetEmployee;
        EXEC GetCustomer;  
    END  
Else IF (@Number < 10) 
    EXEC GetEmployee;

Compliant Code Example

IF (@Number > 10) --Compliant code (Multi-line blocks are enclosed in the BEGIN ... END blocks.)
    BEGIN
        EXEC GetEmployee;
        EXEC GetCustomer;  
    END
Else IF (@Number < 10) 
    EXEC GetEmployee;
Visual Expert 2020
 VETSQLRULE30