Mathias Mathias - 20 days ago 9
SQL Question

Add a column with a default value to an existing table in SQL Server

How can a column with a default value be added to an existing table in SQL Server 2000 / SQL Server 2005?

Answer
ALTER TABLE {TABLENAME} 
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} 
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
[WITH VALUES]