Results 1 to 5 of 5

Thread: empty a table

  1. #1
    Join Date
    Aug 2005
    Posts
    55

    Unanswered: empty a table

    hi everyone,

    i was just wondering, is there anyway to empty a table...like, in mysql u can go EMPTY TABLE

    and it resets the identity stuff, so your id's start at zero again...?

    Thanks, Justin

  2. #2
    Join Date
    Apr 2004
    Posts
    50
    You can use one of the following statements:

    DELETE FROM YourTable

    TRUNCATE TABLE YourTable

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    DELETE will not reset the Identity value.
    TRUNCATE will.
    If it's not practically useful, then it's practically useless.

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

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by freefall
    ...like, in mysql u can go EMPTY TABLE
    no you can't

    but thankfully, TRUNCATE TABLE works in mysql too

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Aug 2005
    Posts
    55
    Quote Originally Posted by r937
    no you can't

    but thankfully, TRUNCATE TABLE works in mysql too

    hi, well, havent used mysql in a little while..

    maybe it was known as empty table in 3.x and 4.x versions of mysql...if not, then im not sure where i got it from...or maybe that just what phpmyadmin called it.

    but thats for the replies,

    Cheers, Justin

Posting Permissions

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