Today a new company trainee just remind me one thing when I try to compare a string with null values.
NULL in Database is not a value.
Yes right. In SQL NULL is treated as UNKNOWN value, which is different from empty string. So if you want to compare with NULL, you need to use "IS" or "IS NOT" statement. (keep reminding myself)
Luckly SQL has an extension to overcome this problem.
If you really want to compare NULL with a "=" or "<" or "<>" or ">" as a value. You can set the ANSI_NULLS to OFF.
For me personally I am a C# person. I am more likely to use "=" signs in store procedures.
However in simple testing query. I may be just "IS" or "IS NOT"
Thursday, June 21, 2007
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment