Organizational Research By

Surprising Reserch Topic

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?

asked Jun 9, 2015 in MYSQL by rajesh
0 votes
50 views



Related Hot Questions

2 Answers

0 votes
ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
[WITH VALUES]
answered Jun 9, 2015 by rajesh
0 votes
ALTER TABLE <table name> 
ADD <new column name> <data type> NOT NULL
GO
ALTER TABLE <table name> 
ADD CONSTRAINT <constraint name> DEFAULT <default value> FOR <new column name>
GO
answered Jun 9, 2015 by rajesh

...