Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Truncate db / table incorrect

forums forums SQLyog SQLyog: Bugs / Feature Requests Truncate db / table incorrect

  • This topic is empty.
Viewing 2 reply threads
  • Author
    Posts
    • #7836
      webRat
      Member

      Your SQL statement to truncate something is incorrect.

      I clicked on DB -> Truncate DB

      Result:

      [6:04:24 PM][ 0 ms] delete from `devrat`.`category`

      The SQL should be: truncate table 'devrat'.'category'

      Truncate in every RDBMs that I know of resets the autonumber. Just deleting from the table does not reset the autonumber.

      Also, Where's Truncate Table under Table -> ?

      I would also recommending that if you're going to have a truncate command that you bring up a prompt that says, are yoooou sure? Are yoooou absolutely positive?

    • #14078
      webRat
      Member

      FYI: http://www.mysql.com/doc/en/TRUNCATE.html

      Quote:
      syntax: TRUNCATE TABLE table_name

      TRUNCATE TABLE differs from DELETE FROM … in the following ways:

      * Truncate operations drop and re-create the table, which is much faster than deleting rows one by one.

      * Not transaction-safe; you will get an error if you have an active transaction or an active table lock.

      * Doesn't return the number of deleted rows.

      * As long as the table definition file `table_name.frm' is valid, the table can be re-created this way, even if the data or index files have become corrupted.

      TRUNCATE is an Oracle SQL extension.

    • #14079
      Ritesh
      Member

      Hmmmmmmmmmm….

      Thanks for the information 😀

Viewing 2 reply threads
  • You must be logged in to reply to this topic.