A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

What is wrong with this SQL?



 
 
Thread Tools Display Modes
  #1  
Old November 30th, 2009, 07:06 PM posted to microsoft.public.access.queries
Joe M.
external usenet poster
 
Posts: 168
Default What is wrong with this SQL?

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.


  #2  
Old November 30th, 2009, 07:10 PM posted to microsoft.public.access.queries
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default What is wrong with this SQL?

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


"Joe M." wrote:

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.


  #3  
Old November 30th, 2009, 07:12 PM posted to microsoft.public.access.queries
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default What is wrong with this SQL?

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

Joe M. wrote:
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.


--
Message posted via http://www.accessmonster.com

 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.