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

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

http://en.wikipedia.org/wiki/Microsoft_SQL_Server#SQL_Server_2005 http://en.wikipedia.org/wiki/Microsoft_SQL_Server#SQL_Server_2005

Answers

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

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/92082/add-a-column-with-a-default-value-to-an-existing-table-in-sql-server

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils