I'd like to know what are the differences between <> NULL and is not null in SQL Server
I have a sp which uses <>NULL syntax to check for not NULL columns but to insert them in a table, but I've noticed that in some cases (some bds and/or servers) it runs ok while in others it fails resulting in a table with no cols inserted (all setted to NULL). I've changed the sp to 'is not null' syntax and now it works properly. What is the reason for this behaviour?Depends. Normally(ANSI SQL):
a<>null = null
whatever a may be. So that does never evaluate to true!
One can change that behavior with SET ANI_NULLS OFF, than you get
a<>null = true
if a is not null and
a<>null = false
if a is null.
HTH,
chris
No comments:
Post a Comment