Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to clear all the data from 10 or maore tables by using single query in mysql?


Thank u in adv...
Posted

Try this together.
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'

More info here[^].
 
Share this answer
 
Comments
Abhinav S 1-Aug-11 9:52am    
My 5.
You could try select * from table where 1 = 2
 
Share this answer
 
v2
Comments
Toniyo Jackson 1-Aug-11 7:51am    
Without table name?
kishore1215 1-Aug-11 8:00am    
no,i have 5 or 6 tables in my db,i need to delete the data from those tables,not tables.
kishore1215 1-Aug-11 8:06am    
if it is possible,it can..without mentioning tha table names..all tables which are present in database..
Abhinav S 1-Aug-11 8:08am    
Fixed that.
However, I think OP was looking for something else.
Toniyo Jackson 1-Aug-11 8:15am    
Yeah. Check my answer :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900