sql - NOT IN clause and NULL values -
 This issue came when I got separate records, which I thought was a  not   where  constraint and another one  runs away . There was a zero value (poor data) in the table in the  no  constraint, due to which the query was returned to the count of 0 records. I understand why I can help fully understand some concept. 
It just tells, why the results of Curie A result a result but B does not?
  A: Select 'right' where in 3 (1, 2, 3, zero) B: Select 'right' where not in 3 (1, 2, blank) < / Code>   It was turned on SQL Server 2005. I also came to know that it happens to return the result code to 
query A is the same:
  select 'true' where 3 = 1 or 3 = 2 or 3 = 3 or 3 = zero    Since  3 = 3  is true, you get results. 
The query B is the same:
  'true' where 3 & lt; & Gt; 1 & 3 & lt; & Gt; 2 and 3 & lt; & Gt; Blank    when  ansi_nulls  is turned on,  3  is unknown, therefore evaluates to invalidate the predicate, and you do not get any rows. 
 When  ansi_nulls  is closed,  3 & lt; & Gt; ; Blank is true, so the evaluation of reality is real, and you get a line. 
Comments
Post a Comment