I have the following:
set @SomeVariable = @AnotherVariable/isnull(@VariableEqualToZero,1) - 1
If @VariableEqualToZero is null it substitutes the 1. I need it to substitute 1 if @VariableEqualToZero = 0 as well. How do I do this?
I have the following:
set @SomeVariable = @AnotherVariable/isnull(@VariableEqualToZero,1) - 1
If @VariableEqualToZero is null it substitutes the 1. I need it to substitute 1 if @VariableEqualToZero = 0 as well. How do I do this?
If you're using SQL Server, you can probably use a nullif statement? (i.e. set the value to null if it's 0 then set it to 1 if it's null - should catch for both 0's and NULLs
You use CASE
instead of
use
COALESCE and ISNULL are essentially just shortcuts for a CASE statement. You can consult the help for the syntax of CASE.