Unix Technical Forum

TRUNCATE TABLE * ?

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


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:27 AM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:27 AM
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:03 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com