What is wrong with this SQL?

J

Joe M.

I am trying to delete all the data from 3 tables using this SQL in a query:

DELETE WBS_List_PRPS.*
FROM WBS_List_PRPS
DELETE WBS_Dates_PRTE.*
FROM WBS_Dates_PRTE
DELETE MWO_Header_ZIW39.*
FROM MWO_Header_ZIW39;

When I try to save I get syntax error in FROM clause. If I only try to
delete from one table:

DELETE MWO_Header_ZIW39.*
FROM MWO_Header_ZIW39;

Then it works fine. What am I missing?

Thanks!
Joe M.
 
D

Daryl S

You can only delete records from one table at a time. You can run the three
delete queries separately.
 
P

PieterLinden via AccessMonster.com

individual statements should be terminated by a semi-colon.

DELETE * FROM WBS_List_PRPS;
DELETE * FROM WBS_Dates_PRTE;
etc.

if you're doing this in code, you could simply do something like this:

DBEngine(0)(0).Execute "DELETE * FROM WBS_List_PRPS;", dbFailOnError
DBEngine(0)(0).Execute "DELETE * FROM WBS_Dates_PRTE;", dbFailOnError
DBEngine(0)(0).Execute "DELETE * FROM FROM MWO_Header_ZIW39;", dbFailOnError
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top