Clarify "Enforce Relationship"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shumaker@cs.fsu.edu

    #1

    Clarify "Enforce Relationship"

    ....please.

    I've found other posts that explain the Cascade options, but the
    Enforce relationships option still is foggy to me.

    As to "enforcing relationship for ... UPDATEs"(with cascade NOT
    checked), then I'm guessing that an update to that key field that would
    normally cascade will instead produce some sort of constraint violation
    error?

    And if Cascade updates is checked, but I try to update a key in a table
    on the many side of a relationship, then this won't cascade "up" to the
    one side will it? Would it just produce a constraint violation?

    With enforce relationship for insert:

    Does this mean if I try to insert into the many side of a relationship
    that I can't insert unless the keys that are related already exist in
    the other table?

    How does this apply to a one-to-one relationship? If I can't insert
    into one table because the key isn't in the other one, how do I insert
    the record with that key into both tables simultaniously? I'm sure I'm
    wrong about some of my guesses here.

    Thanks in advance.

  • Alan Webb

    #2
    Re: Clarify "Enforc e Relationship&qu ot;

    Shumaker,
    Suppose Invoices and items on the invoice, or line items. With
    relationships enforced you could not delete an invoice without first
    deleting it's line items. If the primary key of invoices is something that
    a user types like an invoice number, then you can't change the invoice
    number in invoices without doing something about that same invoice number
    listed in line items. Without cascade update enabled this normally means
    that an invoice number can't be changed without disabling "enforce
    relationships" temporarily, then changing the invoice number in related
    records in line items first, then changing it in invoice, then re-enabling
    "enforce relationships".

    --
    Alan Webb
    knoNOgeek@SPAMh otmail.com
    "It's not IT, it's IS
    <shumaker@cs.fs u.edu> wrote in message
    news:1114727824 .897316.64410@z 14g2000cwz.goog legroups.com...[color=blue]
    > ...please.
    >
    > I've found other posts that explain the Cascade options, but the
    > Enforce relationships option still is foggy to me.
    >
    > As to "enforcing relationship for ... UPDATEs"(with cascade NOT
    > checked), then I'm guessing that an update to that key field that would
    > normally cascade will instead produce some sort of constraint violation
    > error?
    >
    > And if Cascade updates is checked, but I try to update a key in a table
    > on the many side of a relationship, then this won't cascade "up" to the
    > one side will it? Would it just produce a constraint violation?
    >
    > With enforce relationship for insert:
    >
    > Does this mean if I try to insert into the many side of a relationship
    > that I can't insert unless the keys that are related already exist in
    > the other table?
    >
    > How does this apply to a one-to-one relationship? If I can't insert
    > into one table because the key isn't in the other one, how do I insert
    > the record with that key into both tables simultaniously? I'm sure I'm
    > wrong about some of my guesses here.
    >
    > Thanks in advance.
    >[/color]


    Comment

    Working...