chetan chetan - 1 year ago 113
SQL Question

truncate all table in mysql database

Is it possible to truncate all table in mysql database ? what is query for that .

Answer Source

You can do this query:

select 'truncate table ' || table_name || ';' 

Then save results to a script and run it.

Other possibility might be,

  1. Run the query
  2. Copy the results to the clipboard (COPY)
  3. Paste the results into the MySQL command interpreter (PASTE)


If you just run the query you will understand what I am trying to say.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download