tags:

views:

45

answers:

2

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

A: 

Not possible using a single sql query.

Adam
Which is probably a Good Thing.
Brian Hooper
+1  A: 

You can do this query:

select 'truncate table ' || table_name || ';' 
  from INFORMATION_SCHEMA.TABLES;

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)

Done.

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

Pablo Santa Cruz
sorry but, I can't understand your statement , save results to a script and run it.
chetan
OK, do this. I will update the question.
Pablo Santa Cruz