1
的是,有書面形式(SQL服務器2008)更改爲空在一個語句添加主鍵
alter table newclaims
alter column id int not null
go
alter table newclaims
add primary key(id)
表是非常大的,這將有超過它做兩遍,我會更簡潔的方式想知道我是否可以改變可空性並在一個語句中添加主鍵。
的是,有書面形式(SQL服務器2008)更改爲空在一個語句添加主鍵
alter table newclaims
alter column id int not null
go
alter table newclaims
add primary key(id)
表是非常大的,這將有超過它做兩遍,我會更簡潔的方式想知道我是否可以改變可空性並在一個語句中添加主鍵。
documentation for alter table建議您不能同時更改列和添加約束。
ALTER TABLE [ database_name . [ schema_name ] . | schema_name . ] table_name
{
ALTER COLUMN column_name
{
...
}
| ADD
{
...
} [ ,...n ]
完全無關,但你發佈我的燈泡繼續爲我理解如何閱讀該文檔。你發佈那個小片段確實幫助我完全無關 – wootscootinboogie 2013-04-29 18:01:50