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 3219226
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:37:14+00:00 2026-05-17T15:37:14+00:00

Should items like Foreign Keys, Constraints, Default Values, etc be handled by the Database

  • 0

Should items like Foreign Keys, Constraints, Default Values, etc be handled by the Database management system (in this case, MS Sql 2005) or the Application? I have heard opinions from both sides and I’m honestly not sure which way to go.

I originally was going to build it into the database, however I have discovered this is not always possible with the current database design I have. For example, some tables contain circular references and cannot be linked using ON UPDATE CASCADE. Another problem I’m encountering is there is a possibility we will be using multiple databases/servers and Foreign key constraints don’t work across linked servers.

I had some developers recommend I do the data validation on the application layer and leave the database as just that – a place to store data. I like the idea, but I’ve read in a lot of places that it is better to build referential integrity into the database to allow for transactions that don’t get passed through the application layer. I agree with that, although when we are finished all database transactions should be going through the application. Even if we decide to build addins later on, we are using an ObjectModel framework so insert/update/delete queries should never need to be rewritten.

So my question is, in this situation would you still recommend building the referential integrity into the database or is it OK to build it into the application layer instead? And why?

  • 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-17T15:37:15+00:00Added an answer on May 17, 2026 at 3:37 pm

    You should do as much data integrity maintenance as possible in the database. It’s “free” once you declare it, and guaranteed to apply no matter how the data reaches the database. That, to me, seems a no-brainer.

    You brought up several instances of types of database integrity that cannot be declaratively specified in a database. In those cases, obviously, you must program the integrity into the middle layer or front-end and hope for the best.

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

Sidebar

Related Questions

This is what I would like to do: I have assigned the following items:
I would like to access the work items in our TFS programmatically. Shouldn't there
My little site should be pooling list of items from a table using the
One of the items in the Joel Test is that a project/company should have
One of Steve McConnell's checklist items is that you should not monkey with the
Not sure what the correct title for this question should be. I have the
I have a 3 tables that look like this: (source: InsomniacGeek.com ) On the
I'm tying to make a radgrid that sorts items like a bank statement. By
I'd like to add template items in tineMCE editor. The template items act like
I would like to update my SQL lite database with the native update-method of

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.