Organizational Research By

Surprising Reserch Topic

how to add 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 May 22, 2015 in MYSQL by rahulgii
0 votes
41 views



Related Hot Questions

2 Answers

0 votes
 
Best answer
ALTER TABLE {TABLENAME} 
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} 
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
[WITH VALUES]
answered May 22, 2015 by rahulgii
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 May 22, 2015 by rahulgii

...