How do I drop a foreign key in SQL Server?

前端 未结 8 1817
别那么骄傲
别那么骄傲 2020-12-04 10:53

I have created a foreign key (in SQL Server) by:

alter table company add CountryID varchar(3);
alter table company add constraint Company_CountryID_FK foreig         


        
8条回答
  •  死守一世寂寞
    2020-12-04 11:15

    Are you trying to drop the FK constraint or the column itself?

    To drop the constraint:

    alter table company drop constraint Company_CountryID_FK
    

    You won't be able to drop the column until you drop the constraint.

提交回复
热议问题