Professional Web Applications Themes

Integrity via foreign keys or application? - Microsoft SQL / MS SQL Server

>> Just wondering if anyone has run into an issue of whether to maintain referential integrity via the application or via database constraints. << What is the issue? You can NEVER maintain referential integrity via an application. Trying to kludge that would leave the entire schema wide open to any future user to subvert.  [/ref] referential integrity in the database .. << Unh?? Assuming that speed is more important than data integrity, this is still a false argument. DRI clauses are predicates; they can be used by the optimizer in a smart RDBMS system to great advantage.  [/ref] CreditCardType table, ...

  1. #1

    Default Re: Integrity via foreign keys or application?

    >> Just wondering if anyone has run into an issue of whether to maintain
    referential integrity via the application or via database constraints.
    <<

    What is the issue? You can NEVER maintain referential integrity via an
    application. Trying to kludge that would leave the entire schema wide
    open to any future user to subvert.
     [/ref]
    referential integrity in the database .. <<

    Unh?? Assuming that speed is more important than data integrity, this is
    still a false argument. DRI clauses are predicates; they can be used by
    the optimizer in a smart RDBMS system to great advantage.
     [/ref]
    CreditCardType table, <<

    I'd use a CHECK() constraint with that list. It is short and not
    subject to much change.
     [/ref]
    data? <<

    NEVER. How do I stop the future apps from ing up everything?
    "Against stupidity the gods themselves struggle in vain." - Die Jungfrau
    von Orleans; Friedrich von Schiller (1759-1805)

    A professional writes code that lives in the enterprise longer than he
    does, in spite of the users and the other programmers.

    --CELKO--
    ===========================
    Please post DDL, so that people do not have to guess what the keys,
    constraints, Declarative Referential Integrity, datatypes, etc. in your
    schema are.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Joe Guest

  2. #2

    Default Re: Integrity via foreign keys or application?

    Just to expand on Joe's points. Your data will likely have value to your
    organisation far beyond the scope of your original application. For CRM and
    management reporting for example. Writing those types of ytical queries
    or trying to migrate the data to a warehouse is a far more complex task
    without declared constraints and keys. Time spent on good database design
    will pay you back many-fold in the long term - in ways that you can't even
    foresee today.

    --
    David Portas
    ------------
    Please reply only to the newsgroup
    --



    David Guest

  3. #3

    Default Re: Integrity via foreign keys or application?

    On Sun, 27 Jul 2003 22:36:03 -0700, "Richard G" <net>
    wrote:
     

    If you use DRI, you can generate header files from data in the
    referenced table. It's not always practical--some apps do need all
    the values in "real" time.
     

    First project I worked on as an independent contractor--a small
    inventory application for a chemical pilot plant, migrated (and fixed)
    from one dbms to another--I found about 200 errors a day for six
    months. In the words of one of the chemical engineers, "A rocket
    propellant and a kosher food additive are both useful items, but
    hardly interchangable."

    --
    Mike Sherrill
    Information Management Systems
    Mike Guest

Similar Threads

  1. Foreign keys tut
    By frizzle in forum MySQL
    Replies: 2
    Last Post: July 18th, 05:45 PM
  2. Compound and foreign keys
    By Jimi Hullegård in forum MySQL
    Replies: 3
    Last Post: October 22nd, 10:23 AM
  3. foreign keys
    By Sybrand Bakker in forum Microsoft Access
    Replies: 2
    Last Post: July 25th, 10:04 PM
  4. DMO + Foreign Keys
    By oj in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 8th, 05:58 AM
  5. SQL DMO + Foreign Keys
    By Steven Campbell in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 4th, 09:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139