Consider:

|declare @var bit

if (select @var)<>  1
 print 'value is not equal to 1'
else
print 'value is 1'
|

assuming ANSI_NULLS is on then the output is:

   value is 1

What are some common ways that people deal with this 'gotcha' ? eg
1) don't use <> operator at all
2) use ISNULL

Please consider the case where the select is a (more) complex statement.


Regards

Wal

Reply via email to