Possible Duplicate:
IS NULL vs = NULL in where clause + SQL Server
Consider the following code – can someone explain to me why the one query doesn’t throw an error? I can understand why it doesn’t return a record, but what is it trying to do? Remember that colA is an int. It works the same on 2000,2005 and 2008 r2
create table #foo
( colA int )
insert into #foo
(colA)
values
(null)
select * from #foo --returns the one record we just created
select * from #foo where colA = null --does not throw an error and does not return a record! why??
select * from #foo where colA is null --returns the record
drop table #foo
Is there ever record that could exist in this table that would return for colA = null?
I dont have any other databases available to me at the moment to try this out - is this standard or is it behavior specific to MSSQL?