A Theory Question...
When a set of queries as given below is fired then...
Create table Temp1(C1 varchar(2))
Create table Temp2(C1 varchar(2))
insert into Temp1 Values('A'),(NULL),('B')
insert into Temp2 Values('B'),(NULL),('C'),(NULL)
select *from Temp1 A,Temp2 B
where A.C1 <> B.C1
...gives...
I used A.C1 <> B.C1
in the Where
clause.
But I expect...
To get expected result as output I needed to use ISNULL(A.C1,'') <> ISNULL(B.C1,'')
in the Where
clause.
My Question is why do I need to use ISNULL
every time for getting output as expected, as NULL
is not equal to any string data.