How do I add a column, with a default value, to an existing table in SQLServer 2008?
18
ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
Add a column with a default value to an existing table in SQL Server
9
-
2As a general rule, it is best to name your constraints. If you don't it will get a random name, and they will differ between different databases (eg at different client installations). This will make scripting changes difficult in some cases (ie you will have to resort to workarounds). – TT. Jun 5 '13 at 6:22
-
1