• I don't get it. Could you please post sample data and expected results? Check the article linked on my signature to guide you.

    Your description and the results seem to match, but I might be misunderstanding the whole problem.

    This is what I used to test.

    WITH CTE(col1, col2) AS(

    SELECT 'abc' col1, 'bbc' col2 UNION ALL

    SELECT 'nbc' col1, 'abc' col2 UNION ALL

    SELECT NULL col1, NULL col2 )

    SELECT *

    FROM CTE

    WHERE ISNULL( col1, '') NOT IN ('abc', 'def', 'ghi')

    OR (col2 is null or isnull(col2,' ') NOT IN ('abc', 'def', 'ghi'))

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2