T-SQL Bit Field in View
Hi,
I’m not sure if this is the proper place for a T-SQL question. If not, I’d appreciate a pointer to the correct forum.
I have a view, and I would like a field that shows whether or not a specific value is null.
If I use this
“IsNull” = CASE WHEN MyValue IS NULL THEN 1 ELSE 0 END
it ends up with exactly what I would want. It’s a non-nullable field, except it’s an integer.
Now, if I wrap that entire CASE in either a CAST or CONVERT to BIT, the resulting bit field is nullable.
How do I tell SQL Server that the field is not nullable?
Thanks in advance for any help,
Chris
Hi, I’m not sure if this is the proper place for a T-SQL question. If not, I’d appreciate a pointer to the correct forum. I have a view, and I would like a field that shows whether or not a specific value is null. If I use this “IsNull” = CASE WHEN MyValue IS NULL THEN 1 ELSE 0 ENDit ends up with exactly what I would want. It’s a non-nullable field, except it’s an integer. Now, if I wrap that entire CASE in either a CAST or CONVERT to BIT, the resulting bit field is nullable. How do I tell SQL Server that the field is not nullable? Thanks in advance for any help,Chris Read More