Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Join Date
    Feb 2004
    Posts
    134

    Unanswered: Deleting records

    How do I delete one record from one table and cascade down all related tables?


    Mike B

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    KBA1 & KBA2 to highlight issue if any trigger is involved.


    This one too http://www.sqlteam.com/item.asp?ItemID=8595
    HTH
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Establish cascading deletes between your tables, or use a trigger.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Feb 2004
    Posts
    134
    Thanks for the replies guys, but apparently, I just have to learn patience. I am getting SQL Server 2000 at the end of the month and this supports Cascading DRI .

    Mike B

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Gotta be the same Mike

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=33023

    What about performance though..being "old school", I do it the old fashion way...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    What version are you using now? Hasn't cascading been a feature since at least 7.0, if not 6.5?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Yeah...but you gotta remeber there's more than one platform...

    DB2 OS/390, Oracle, SQL Server...oye

    changing gears can get REAL interesting sometimes....

    I guess I'm just from the school that here is no such thing as a key change...it's a new element...

    and cascading deletes? I would imagine, is like giving a gun to a 2 year old for most developers...

    no?

    "OH SH-T, It's a MIRACLE! ALL THE DATA IS GONE!"




    Hey...triggers is hard enough for them to understand...

    "Why are there 2 Rows affected?"
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Yeah, but my policy is not to design databases or write code for the lowest common denominator. If a business is too cheap to hire a competent DBA or Developer who can understand what I've built, then they deserve to have problems.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  9. #9
    Join Date
    Feb 2004
    Posts
    134
    Originally posted by blindman
    What version are you using now? Hasn't cascading been a feature since at least 7.0, if not 6.5?
    Update and Insert yes, not deleting

    Mike B

  10. #10
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Originally posted by blindman
    What version are you using now? Hasn't cascading been a feature since at least 7.0, if not 6.5?
    6.5 never had it, neither did 7.0

  11. #11
    Join Date
    Jan 2004
    Location
    Ottawa, Canada
    Posts
    53
    Fully agree,

    As a developer I would never touch an application until I understood the data model and business rules defining it.

    I find that triggered deletes too often get overlooked by developers, more so than the expectation that deletes WILL cascade throughout the data model.

    Nothing worse than orphaned entries when trying to troubleshoot data errors.
    Originally posted by MikeB_2k4
    Update and Insert yes, not deleting

    Mike B

  12. #12
    Join Date
    Feb 2004
    Posts
    134
    Originally posted by Brett Kaiser
    Yeah...but you gotta remeber there's more than one platform...

    DB2 OS/390, Oracle, SQL Server...oye

    changing gears can get REAL interesting sometimes....

    I guess I'm just from the school that here is no such thing as a key change...it's a new element...

    and cascading deletes? I would imagine, is like giving a gun to a 2 year old for most developers...

    no?

    "OH SH-T, It's a MIRACLE! ALL THE DATA IS GONE!"




    Hey...triggers is hard enough for them to understand...

    "Why are there 2 Rows affected?"
    Extremely valid points!! (and yes it is the same Mike ) I am not sure if I even want to provide the deletion capability, but that doesn't mean I don't have to know how to do it.

    Mike

  13. #13
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Originally posted by blindman
    Yeah, but my policy is not to design databases or write code for the lowest common denominator. If a business is too cheap to hire a competent DBA or Developer who can understand what I've built, then they deserve to have problems.
    What's the largest group you ever worked with?

    And you know...it's always the database that's at fault...

    Until you waste the time and prove them wrong (again)
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  14. #14
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Yeah, and when you do, - they'll gang up on you and wait till it's really the database, and then you'll never hear the end of it... Hate them, hate them all!!!

  15. #15
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    We have about 3K of them here, and only 5 of us...well, 2, if you count real bodies

Posting Permissions

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