Comment by Trigg3r

2 days ago

Am I missing something here in my (MS) SQL world? if a new field is added as null, I do that to the (now) 20 year old system to we don't break 100's of stored procs - any (new) code that needs that field, has to check for it being null...

in sql server, you can simply add a not null check constraint with nocheck (see my comment with full code)

ALTER TABLE foo WITH NOCHECK ADD CONSTRAINT CheckNotnull CHECK (id IS NOT NULL)

any new values coming in cannot be null but the values already in the table with null are fine... then you can update them to not null over time