I have the following:
set @SomeVariable = @AnotherVariable/isnull(@VariableEqualToZero,1) - 1
If @VariableEqualToZero is null it substitutes t
You use CASE
instead of
ISNULL(@VariableEqualToZero,1)
use
CASE WHEN @VariableEqualToZero IS NULL OR @VariableEqualToZero = 0 THEN 1 ELSE @VariableEqualToZero END
COALESCE and ISNULL are essentially just shortcuts for a CASE statement. You can consult the help for the syntax of CASE.