Deleting child table foreignkey entire row on delete in SQL 2008
Posted on 2009-07-08
I have a table Courses which contains 1 field : CN
The other table is ADCourseMapping with 4 fields: ID, CN, SC, ADSG
I have a relationship constraint using Courses.CN as primary key to validate entries in ADCourseMapping.
I have setup the relationship to cascade on update, and cascade on delete.
However, when deleting an entry from Courses.CN, only the corresponding ADCourseMapping.CN field gets deleted. I'm actually interested in removing the whole row, as it would be no longer valid.
Is there any easy way to do this?
Please keep in mind that I have never done any SQL procedures, if accomplishing this involves using a procedure, please be as details as possible.