Short circuit aborts any further processing of a logical expression as soon as its result can be determined. : IF « Transact SQL « SQL Server / T-SQL Tutorial






Short Circuit and Divide by Zero Using the AND Operator
8>
9> IF (0 <> 0) AND (1/0 > 0)
10>   PRINT 'Greater Than 0'
11> GO
1>

Short Circuit and Divide by Zero Using the OR Operator
3> IF (1 > 0) OR (1/0 > 0)
4>   PRINT 'Greater Than 0'
5> GO
Greater Than 0








20.7.IF
20.7.1.The syntax of the IF...ELSE statement
20.7.2.Using an Expression with an Explicit Unknown Value
20.7.3.Using an Expression with an Unknown Value Returned from One of the Participating Simple Logical Expressions
20.7.4.Short circuit aborts any further processing of a logical expression as soon as its result can be determined.
20.7.5.IF (@au_id IS NULL)
20.7.6.IF EXISTS
20.7.7.Use function returned value
20.7.8.IF (SELECT ID FROM inserted) like '99[0-9][0-9]'
20.7.9.IF (SELECT COUNT(*) FROM inserted) > 1
20.7.10.If statement with aggregate function
20.7.11.Use if and like to check a pattern
20.7.12.Implementing the ELSE Statement In Our Sproc
20.7.13.A script that tests for outstanding Billings with an IF statement
20.7.14.uses an IF...ELSE statement