SELECT * FROM pcalot WHERE clotpk NOT IN (SELECT cbcnlotfk FROM pcabcn)However, if I perform one of the following, I get the expected result set returned:
SELECT * FROM pcalot WHERE clotpk NOT IN (SELECT cbcnlotfk FROM pcabcn WHERE cbcnlotfk IS NOT NULL) OR SET ANSI_NULLS OFF SELECT * FROM pcalot WHERE clotpk NOT IN (SELECT cbcnlotfk FROM pcabcn)Something else, I have the same database on another machine running SQL Server 2005 and the first query statement:
SELECT * FROM pcalot WHERE clotpk NOT IN (SELECT cbcnlotfk FROM pcabcn)returned the expected results no matter what the setting of SET ANSI_NULLS.