• If your question was more than just theoretical, another way you could get the NOT 'a' values including NULLs would be to create a temporary column. I have no idea if this would perform better than just using 'OR IS NULL' in the WHERE clause based on this trivial example. I tried these two options against some real data and the query execution plans were the same except for a 'Compute Scalar' operation (due to the ISNULL operator) with an Estimated Operator Cost of 0%. It does seem in my experience though that using 'IS NULL' in a Where clause makes it difficult or impossible to get Index Seeks.

    CREATE TABLE #a (id INT,nm VARCHAR(200))

    INSERT INTO #a

    SELECT

    1

    ,'a'

    INSERT INTO #a

    SELECT

    1

    ,NULL

    SELECT

    id

    ,nm

    FROM

    (

    SELECT

    id

    ,nm

    ,ISNULL(nm,'xxx') AS nm2 --> 'xxx' = some always unique value or use NEWID()

    FROM

    #a

    ) AS temp

    WHERE

    nm2 NOT IN ('a')

    DROP TABLE #a