简体   繁体   中英

SQL Server drop foreign key constraint

I am trying to drop a foreign key constraint but I am getting this error:

Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword 'FOREIGN'.

And this is what I have as far as code:

ALTER TABLE SALE
    DROP CONSTRAINT SaleFK      FOREIGN KEY(SaleCustID)
                                REFERENCES  BUYER (BuyerID)
                                ON UPDATE NO ACTION
                                ON DELETE CASCADE;

The answer is probably pretty obvious but it has been a long day...

您只需要约束名称就不需要任何其他信息。

ALTER TABLE SALE DROP CONSTRAINT SaleFK;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM