4 ms·
> Also a null is no equal to anything. Wrong. It is equal to UNKNOWN: https://docs.microsoft.com/en-us/sql/t-sql/queries/is-null-transact-sql?view=sql-server-
by magicalhippo 7y ago
> Also a null is no equal to anything.
Wrong. It is equal to UNKNOWN:
https://docs.microsoft.com/en-us/sql/t-sql/queries/is-null-transact-sql?view=sql-server-ver15#remarks https://docs.microsoft.com/en-us/sql/t-sql/queries/is-null-t...
- RmDen 7y agoso?.. still not equal to anything, two unknowns are not equal if null = null print 'true' else print 'false'
- magicalhippo 7y agoIt's equal to something: the value UNKNOWN. This influences for example how the comparison result is used in compound expressions: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/null-and-unknown-transact-sql?view=sql-server-ver15 https://docs.microsoft.com/en-us/sql/t-sql/language-elements...
- arh68 7y agoI don't think that's what it says. If I'm reading it right, (null = null) is unknown, which is falsy (except with ansi_nulls off, then it'll be true). (null is null) is true. I don't think you can test null = (null = null), i.e. null = unknown. Let me know if that's possible somehow, I can't get it working.
- magicalhippo 7y agoSorry brainfart, was responding to the second part, ie comparison to another null.