Home

Two branches in a conditional structure should not have exactly the same implementation

Rule description

  • Two branches in a conditional structure should not have exactly the same implementation

 

Non-compliant Code Example

IF @input_number = 100
  BEGIN
    SET @input_number = 110
    SELECT FIRSTNAME FROM Employee_CR ORDER BY FIRSTNAME
  END
ELSE IF @input_number = 200 --Non compliant code (Two branches is having similar implementation)
  BEGIN
    SET @input_number = 110
    SELECT FIRSTNAME FROM Employee_CR ORDER BY FIRSTNAME 
  END
ELSE
  BEGIN
    SET @input_number = -1
    SELECT FIRSTNAME FROM Employee_CR
  END
GO
Visual Expert 2020
 VETSQLRULE31