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

  • Home
  • SEARCH
  • 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 40589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:02:50+00:00 2026-05-10T15:02:50+00:00

When setting up foreign keys in SQL Server, under what circumstances should you have

  • 0

When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it?

This probably applies to other databases as well.

I’m looking most of all for concrete examples of each scenario, preferably from someone who has used them successfully.

  • 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. 2026-05-10T15:02:51+00:00Added an answer on May 10, 2026 at 3:02 pm

    Summary of what I’ve seen so far:

    • Some people don’t like cascading at all.

    Cascade Delete

    • Cascade Delete may make sense when the semantics of the relationship can involve an exclusive ‘is part of‘ description. For example, an OrderLine record is part of its parent order, and OrderLines will never be shared between multiple orders. If the Order were to vanish, the OrderLine should as well, and a line without an Order would be a problem.
    • The canonical example for Cascade Delete is SomeObject and SomeObjectItems, where it doesn’t make any sense for an items record to ever exist without a corresponding main record.
    • You should not use Cascade Delete if you are preserving history or using a ‘soft/logical delete’ where you only set a deleted bit column to 1/true.

    Cascade Update

    • Cascade Update may make sense when you use a real key rather than a surrogate key (identity/autoincrement column) across tables.
    • The canonical example for Cascade Update is when you have a mutable foreign key, like a username that can be changed.
    • You should not use Cascade Update with keys that are Identity/autoincrement columns.
    • Cascade Update is best used in conjunction with a unique constraint.

    When To Use Cascading

    • You may want to get an extra strong confirmation back from the user before allowing an operation to cascade, but it depends on your application.
    • Cascading can get you into trouble if you set up your foreign keys wrong. But you should be okay if you do that right.
    • It’s not wise to use cascading before you understand it thoroughly. However, it is a useful feature and therefore worth taking the time to understand.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 94k
  • Answers 94k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer hasattr internally and rapidly performs the same task as the… May 11, 2026 at 6:47 pm
  • Editorial Team
    Editorial Team added an answer Does it have to be a Const? You can get… May 11, 2026 at 6:47 pm
  • Editorial Team
    Editorial Team added an answer You may want to add a !path somewhere to point… May 11, 2026 at 6:47 pm

Related Questions

I have two models, Room and Image . Image is a generic model that
When setting up a new virtual directory for hosting a SOAP web service in
When setting up a rollover effect in HTML, are there any benefits (or pitfalls)
When setting up a Visual Studio .NET solution with many projects, do you find

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.