November 5, 2008 at 6:10 am
November 5, 2008 at 6:18 am
Sorry, this is the wrong forum for this question, but still.. any answers???
November 5, 2008 at 6:27 am
It depends on your setting for ANSI_NULLS
is you set this to off
SET ANSI_NULLS off
then your code will return 'NULL is equal to 3041'
check out this microsoft link for a full explanation.
http://msdn.microsoft.com/en-us/library/aa259229.aspx
This also highlights one of the reasons that it is considerd good practice to have comparisons use '=' to resolve to true, rather than using '<>'
if (@A= @b-2) select 'NULL is equal to 3041'
else select 'NULL is not equal to 3041'
November 5, 2008 at 7:04 am
if (@A <> @b-2) select 'NULL is not equal to 3041'
else select 'NULL is equal to 3041'
@a is not equal to the number in @b-2
If ( @a <> @b-2 ) results in null so does NOT give select 'NULL is not equal to 3041'
the only alternative you give is to output
'NULL is equal to 3041'
Nothing wrong with SQL here, your logic is a touch flawed
November 12, 2008 at 8:29 am
Thank you!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply