• You can't test your SQL properly, because your table doesn't contain the right records. I added a new record to the table so that both CID and MID are both NULL. I selected them using the below query and it worked fine.

    use tempdb;

    GO

    --Create Test Table

    CREATE TABLE [dbo].[Null_Table](

    [CID] [int] NULL,

    [MID] [int] NULL

    ) ON [PRIMARY];

    GO -- execute the create table batch.

    --Insert Sample Data --- note the semicolons!

    insert into Null_Table(CID,MID)

    valueS (123,456);

    insert into Null_Table(CID,MID)

    valueS (123,Null);

    insert into Null_Table(CID,MID)

    valueS (123,0);

    INSERT INTO NULL_TABLE(CID,MID) VALUES (Null, Null);

    -- return all records where both CID and MID are null

    SELECT *

    FROM dbo.Null_Table

    WHERE CID IS NULL

    AND MID IS NULL;