Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete, then insert

Status
Not open for further replies.
Sep 25, 2002
159
US
HI,

I am trying to figure out the correct syntax of a query I've created that I need to first delete everything in a table and then insert some things. I'm trying to make one long SQL statment, but I'm not sure of the syntax. This obviously didn't work:

DELETE Table1
INSERT INTO TABLE1 (fieldx)....
 
Perhaps this ?
DELETE FROM Table1;
INSERT INTO TABLE1 (fieldx)....

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I should show my entire SQL statement because its not working. I am using MS Access and it is giving me a prompt saying 'characters found after end of SQL statement':

DELETE *
FROM uniqueDates;
INSERT INTO uniqueDates ( Entry_Date )
SELECT entry_date
FROM [SELECT Entry_Date FROM BarcelonaInternalActions
UNION SELECT Entry_Date FROM QPTActions
UNION SELECT Entry_Date FROM TokyoInternalActions
UNION SELECT FORMAT(Entry_Date , "Short Date")
FROM RDActions
]. AS U;
 
MS Access admits only single instruction in the SQL view pane, period.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top