• When you look at your messages window you'll notice the message "Warning: Null value is eliminated by an aggregate or other SET operation." which will explain your situation.

    It is because you are counting the item in the column containing the NULL values. These NULL values will (default) be eliminated in the count. To get the desired results you can count on another column or all columns. See the example below:

    create table #test (id int, value int)

    insert into #test

    select 1,1

    union all select 2,null

    union all select 3,null

    union all select 4,2

    select

    count(value) as total_NULL_column

    , count(ID) as total_ID_column

    , count(*) as total_all_columns

    from #test

    where value is null

    drop table #test

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **