Sunday, February 19, 2012

DELETE records.

Hello,

I have 3 tables with their columns as follows:

+ LabelsInDocs [LabelId] PK FK , [DocsId] PK FK

+ Labels [LabelId] PK , [LabelName]

+ Docs [DocId] PK , [DocUrl]

I set Cascade Delete On so when I delete a Doc all records in
LabelsInDocs will be deleted.

However, when a Doc is deleted I want also to delete all records in
Labels for the labels which do not have any Doc associated to it in
LabelsInDocs.

How can I do this?

Thanks,
Miguel

See: http://www.sqlteam.com/item.asp?ItemID=8595

Hope it helps!

No comments:

Post a Comment