Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将具有默认值的列添加到 SQLServer 2008 中的现有表?
ALTER TABLE {TABLENAME} ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
将具有默认值的列添加到 SQL Server 中的现有表
使用ALTER TABLE. 例如
ALTER TABLE
ALTER TABLE Table1 ADD col2 INT DEFAULT 0;
SQLFiddle