To add to what flamblaster showed: In most cases, NULL is not equal to NULL (or anything else), but this is one of those cases where one can interpret that SQL Server is treating NULL as being equal to NULL. Adding one more row to the example, the except query: declare @table1 table (id int, col varchar(2))declare @table2 table (id int, col varchar(2))insert into @table1 (id, col)values (1, null), (2, 'te'),(3,NULL)insert into @table2 (id, col)values (1, 'ex'), (2, 'te'),(3,NULL);select *from @table1exceptselect *from @table2
This still returns one row.