Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 380519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:59:49+00:00 2026-05-12T14:59:49+00:00

Im going through a project I have taken over, and on the database side

  • 0

Im going through a project I have taken over, and on the database side I have noticed that the previous programmers have written a bunch of triggers to delete child records. The thing is, these records already have a a foreign key relationship with the parent record I am deleting. The delete triggers are nothing but simple delete statements for the child records.

Is there a benefit to writing a trigger to delete child records, or can I just change it to cascade on delete and be fine?

Im using MSSQL 2008.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:59:49+00:00Added an answer on May 12, 2026 at 2:59 pm

    CASCADE DELETE in MSSQL Server can only cascade to a single table. If you have two tables with foreign key relationships to a dimension table, you can only cascade delete to one of them. (This is to prevent deletes cascading through multiple paths and creating conflicts, much as C++ allows multiple inheritance but C# only allows single inheritance)

    When this is the case, you are forced to use triggers or specifically handle the case in your code.

    For this reason I have seen many people opt for using triggers in all cases. Even when there is only one foreign table. This ensures consistency and so people know what to look for when maintaining the database.

    If one could cascade a delete to more than one table I would say it would be the most preferable option. This limitation, however, muddies the waters and I’m currently more in favour of triggers owning all such behaviours. The overhead in using triggers for cascaded deletes and updates is only minor in terms of coding, but does allow for standard practices that are truely generic.

    EDIT:

    You might want to move the ‘accepted answer’ to someone else, I’ve worked out I was wrong abot the above.

    You CAN have multiple fact tables have ON DELETE CASCADE Foreign Key Contraints to a signle Dimension table.

    What you Can’t do is have one Fact Table have have ON DELETE CASCADE Foreign Key Constraints to multiple Dimension Tables.

    So for example…
    – Dimension Table [Person] (id INT IDENTITY, )
    – Dimension Table [Exam] (id INT IDENTITY, )
    – Face Table [Exam_Score] (person_id INT, exam_id INT, score INT)

    If either the Person or the Exam are deleted, you’d want the associated Exam_Score record(s) to also be deleted.

    This is not possible using ON DELETE CASCADE in MS SQL Server, thus the need for triggers.

    (Apologies to Mehrdad who tried to explain this to me but I completely missed his point.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're going through a massive migration project at the minute and trying to validate
I'm going through SICP and I'd like to have an interpreter analogous to the
I am working on a project for a client and going through the initial
I have taken the org.eclipse.equinox.p2.examples.rcp.prestartupdate project and adapted it for use in my RCP
I am going through the Zend Framework "quickstart" tutorial at the mo'. I have
I'm thinking about starting a new project using EF 4 and going through some
While going through university and from following the development of SO, I've heard a
After going through the Appendix A, C# Coding Style Conventions of the great book
I'm going through the problems on projecteuler.net to learn how to program in Erlang,
I was going through the AWDR book on web development with ruby on rails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.