Can I add a not null column without DEFAULT value

后端 未结 10 1541
Happy的楠姐
Happy的楠姐 2020-12-13 07:56

Can I add a column which is I specify as NOT NULL,I don\'t want to specify the DEFAULT value but MS-SQL 2005 says:

ALTER TABLE only allows columns to

10条回答
  •  难免孤独
    2020-12-13 08:44

    No - SQL Server quite reasonably rejects this, because it wouldn't know what value existing rows should have

    It's easy to create a DEFAULT at the same time, and then immediately drop it.

提交回复
热议问题