Home
Non-standard comparison operators should not be used
Rule description
- Non-standard comparison operators should not be used
Non-compliant Code Example
DECLARE @Number int; SET @Number = 50; IF @Number !> 10 --Non compliant code (Non-standard comparison operators is used) BEGIN Select * From Employee Where id < @Number; PRINT 'The number is less then 10.'; END ELSE IF @Number !< 100 --Non compliant code (Non-standard comparison operators is used) BEGIN Select * From Employee Where id < @Number; PRINT 'The number is greater then 100.'; END ELSE PRINT 'The number is medium.'; GO
Compliant Code Example
DECLARE @Number int; SET @Number = 50; IF @Number < 10 --Compliant code (Standard comparison operators is used) BEGIN Select * From Employee Where id < @Number; PRINT 'The number is less then 10.'; END ELSE IF @Number > 100 --Compliant code (Standard comparison operators is used) BEGIN Select * From Employee Where id < @Number; PRINT 'The number is greater then 100.'; END ELSE PRINT 'The number is medium.'; GO