Define the DEFAULT
value and use WITH VALUES
:
ALTER TABLE dbo.YourTable ADD NewColumn datetime2(7) NOT NULL DEFAULT '0001-01-01T00:00:00.0000000' WITH VALUES;
Though, a default value of 0001-01-01T00:00:00.0000000
is pretty odd. Seems like, in my opinion, it should be NULL
. NULL
means an unknown value, and clearly you don't know what the value of these rows should be.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…