Domanda

I would like to see some example how to modify foreign key relationship in TSQL because it is missing here http://technet.microsoft.com/en-us/library/ms175493.aspx

Actually I want to apply delete rule Cascade.

Should it be like?

ALTER TABLE Email MODIFY
   CONSTRAINT FK_EmailContact_Email  
      ON DELETE CASCADE

Thank you!

enter image description here

È stato utile?

Soluzione

I found how I can do it

GO
ALTER TABLE EmailContact DROP
   CONSTRAINT FK_EmailContact_Email
GO
ALTER TABLE EmailContact ADD
   CONSTRAINT FK_EmailContact_Email  
       FOREIGN KEY (EmailId)
      REFERENCES Email (Id)
      ON DELETE CASCADE
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top