Results 1 to 15 of 15

Thread: Trucate Command

  1. #1
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Unhappy Unanswered: Trucate Command

    ?Question:
    If I use the truncate command on a table with over 200,000,000 record will I lose all of contraint & attribute within the identical table. The temp_table B is based off the table main table A that has to go.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Data in tables is independent from data in other tables.

    Views, stored procedures, and code that references your original table will be affected if truncate the data in the original table.

    MAKE A BACKUP FIRST!
    If it's not practically useful, then it's practically useless.

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

  3. #3
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Are there any relationships between the tables? You don't have cascading deletes on do you? That would make your life interesting. As long as there's no relational integrity between the tables you will be okay.

    Like blindman said though, MAKE A BACKUP FIRST!
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Cascading deletes do not have any relationship to TRUNCATE. RI will prevent you from issuing this statement until you drop the foreign key from the dependent objects.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by blindman
    Data in tables is independent from data in other tables.

    ouch...ouch...excuse me why I get up off the floor.....

    that's better....

    Now....Huh?



    Been hitting the local bars at lunch blind dude?
    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
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Quote Originally Posted by rdjabarov
    Cascading deletes do not have any relationship to TRUNCATE. RI will prevent you from issuing this statement until you drop the foreign key from the dependent objects.
    That's true.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    "Been hitting the local bars at lunch blind dude?"

    No. Why do you ask?
    If it's not practically useful, then it's practically useless.

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

  8. #8
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Data in tables is independent from data in other table?
    Hell, there goes the Relational model....

    I KNOW that's not what you meant....what did you mean?
    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.

  9. #9
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I've been told (by somebody on this forum) that "Relational" in Relational database does not stand for relationships between tables, but for the fact that data values within a record are related.

    My point was just that unless the developer codes a logical or physical dependency between two tables, there is no reason for actions on one to affect another.
    If it's not practically useful, then it's practically useless.

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

  10. #10
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    I still don't get it: what's the difference between logical and physical dependency, and how do you "code" either one? Unless you're coming up with your own definition of implementing DRI while referring to it as "code[-ing] a logical or physical dependency between tables", - you lost me on your first post on this subject...
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  11. #11
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Yes, when I referred to coding I was including DRI and everything that goes along with database application development. I don't really care about the semantics so much, and I don't want to stray from the point that deleting data from a table is not going to affect data in another table that was derived from it unless the developer specifically intends it to.
    If it's not practically useful, then it's practically useless.

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

  12. #12
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Far out, man, far out. I think you're trying to justify what you said in the first post, which could have been driven by your misinterpreting garrydawkins' question:
    If I use the truncate command on a table with over 200,000,000 record will I lose all of contraint & attribute within the identical table. The temp_table B is based off the table main table A that has to go.
    But hey, let's just leave it at this: If DRI is in place, - you can't truncate the parent
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  13. #13
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Ok. We'll leave it at that, and everyone else on the forum can breathe a sigh of relief.

    If it's not practically useful, then it's practically useless.

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

  14. #14
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by blindman
    Ok. We'll leave it at that, and everyone else on the forum can breathe a sigh of relief.

    Yea vous!

    -PatP

  15. #15
    Join Date
    Jan 2003
    Location
    Pittsburgh, PA
    Posts
    86
    "Relational" in relational database refers to relational math, which is the underlying mathematical concepts used in the database structure. It actually has nothing to do with relations.

Posting Permissions

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