SQL to clear multiple Tables

kriemer

Registered User.
Local time
Yesterday, 22:16
Joined
Aug 28, 2005
Messages
38
I am currently using this Query to delete all records in Table x:
Delete * From x;

Then repeating similar for Table y, then Table z, etc


I would like to delete all records from multiple Tables in a single step, e.g.:
DELETE x.*, y.*, z*
FROM x, y, z;

I get an error message "could not delete from specified tables". Could anyone tell me where where I am going wrong?

Thanks

k
 
are any of the tables linked ?

maybe its the order they are being deleted in
 
kriemer said:
I would like to delete all records from multiple Tables in a single step, e.g.:
DELETE x.*, y.*, z*
FROM x, y, z;
k

You can't.
You need to follow your original approach.

RV
 
If the tables are related in a hierarchial manor such as Orders - OrderDetails, when you delete an order, you want to delete all related detail items, you need to define their relationship using the relationship window, select the enforce referential integrity box and then check the cascade delete box.

If the tables are unrelated, you must run three separate queries. If you want to automate the task, create a form with a button and let the code in the click event of the button run the queries or create a macro (I don't recommend macros).
 
Thanks for all the suggestions

Wonderful, wonderful, wonderful!!!
 

Users who are viewing this thread

Back
Top Bottom