I was debugging a stored procedure the other day and found some logic something like this:
SELECT something FROM someTable WHERE idcode <> (SELECT ids
try this, may run faster because of index usage:
SELECT something FROM someTable LEFT OUTER JOIN tmpIdTable ON idcode=ids WHERE ids IS NULL