TRUNCATE TABLE * ?

This is a discussion on TRUNCATE TABLE * ? within the MySQL Database forums, part of the Database Forums category; the above does not work. How can I TRUNCATE all tables without having to explicitly specify each one? Thanks....


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-01-2007
Herb
 
Posts: n/a
Default TRUNCATE TABLE * ?

the above does not work.

How can I TRUNCATE all tables without having to explicitly specify
each one? Thanks.

Reply With Quote
  #2 (permalink)  
Old 09-01-2007
Brian Wakem
 
Posts: n/a
Default Re: TRUNCATE TABLE * ?

Herb wrote:

> the above does not work.
>
> How can I TRUNCATE all tables without having to explicitly specify
> each one? Thanks.



I don't think this is possible.

You can do it programmatically using the answer to SHOW TABLES of course.


--
Brian Wakem
Reply With Quote
  #3 (permalink)  
Old 09-02-2007
lark
 
Posts: n/a
Default Re: TRUNCATE TABLE * ?

== Quote from Brian Wakem (no@email.com)'s article
> Herb wrote:
> > the above does not work.
> >
> > How can I TRUNCATE all tables without having to explicitly specify
> > each one? Thanks.

> I don't think this is possible.
> You can do it programmatically using the answer to SHOW TABLES of course.


or you can type all of the truncate statements in a text file and then just run
the file from the server prompt.

for example:
truncate tableA;
truncate tableB;
truncate tableC;

all saved in a file called truncateDB.sql so then you login to your server and
once on mysql prompt, just run this file. if you add any more table, just add a
truncate line to this file for that table.

--
POST BY: lark with PHP News Reader
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:23 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0