• Duh, my bad Matt. I had a brain cramp. A primary key cannot contain a nullable column. I was thinking unique constraints which would be a natural or conceptual primary key. So this code will only allow the first insert to complete.

    CREATE TABLE null_primary_key_test

    (

    id INT IDENTITY(1,1),

    null_column INT NULL CONSTRAINT uc_null_column UNIQUE

    )

    GO

    INSERT INTO null_primary_key_test (

    null_column

    )

    SELECT NULL

    -- the 2 causes the batch to execute twice

    GO 2

    DROP TABLE null_primary_key_test