I have a column that is specifyed as (int, not null). I've been trying to insert NULL for the missing records of that column, can anyone give me a hint?

  • 2
    There are two solutions. First of them - alter column allowing NULLs. Second - select another value that will mean that the value is missing (for example, 0, -1 or max_int). – Akina May 16 '18 at 10:04

No you cant insert NULL in a NON NULL column. That's what constraints are for.

If you want, you can alter the column.

ALTER TABLE dbo.mytable

Or just insert 0 for each record you don't want to have a value.

Though be aware on the difference of NULL and blank/zero values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.