This is not valid...
DECLARE @isValid BIT = 0
DECLARE @value INT = 0
SET @isValid = @value <> 0
How do I set @isValid when @value is not equal to 0?
SQL-Server does not know a data-type boolean. The type BIT
is a special integer restricted to 0
or 1
. Expressions can be evaluated to TRUE
or FALSE
.
You might use this:
SET @isValid = CASE WHEN @value<>0 THEN 1 ELSE 0 END;