sql server - Altering multiple objects in in query -
the code below attempting alter 2 columns @ once in table. can done , doing wrong?
alter table verdata add primary key(asset_id) add foreign key(asdes) references assetdesc(assetdescription)
to add constraints in alter query,
follow below,
alter table add constraint adds table-level constraint existing table. supported table-level constraint type can added via alter table. following limitations exist on adding constraint existing table:
when adding foreign key or check constraint existing table, derby checks table make sure existing rows satisfy constraint. if row invalid, derby throws statement exception , constraint not added.
all columns included in primary key must contain non null data , unique.
alter table add unique or primary key provide shorthand method of defining primary key composed of single column. if primary key specified in definition of column c, effect same if primary key(c) clause specified separate clause. column cannot contain null values, not null attribute must specified.
for information on syntax of constraints, see constraint clause. use syntax table-level constraint when adding constraint add table add constraint syntax.
Comments
Post a Comment