Why the query below is not working? Doesn't a logical expression return a boolean/bitwise value?
SELECT @v1 = CAST( (@v2 > 0) AS INT)
Why the query below is not working? Doesn't a logical expression return a boolean/bitwise value?
SELECT @v1 = CAST( (@v2 > 0) AS INT)
Following statement will do what you are trying to achieve.
SELECT @V1 = IIF ( @V2 > 0, 1, 0 )