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.
我必须使用 IF EXIST 检查删除外键约束。我怎样才能做到这一点..
通过使用以下块,您可以实现这一点
IF EXISTS (SELECT * FROM sys.foreign_keys WHERE name = 'fk_vMessageType') BEGIN EXEC ('ALTER TABLE HL7_MessageHierarchy DROP CONSTRAINT fk_vMessageType FOREIGN KEY (vMessageType) REFERENCES HL7_MessageType(vMessageType) ') END