Clear All data in Temp Data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to save data to a temp table. I'd like all existing data in the
temp table to be cleared before the new data inserted. How can I do that
using SQL?
Thanks in a advance.
 
Samantha said:
I'm trying to save data to a temp table. I'd like all existing data
in the temp table to be cleared before the new data inserted. How
can I do that using SQL?
Thanks in a advance.

DELETE TableName.* FROM TableName
 
Hi, Samantha.
I'd like all existing data in the
temp table to be cleared before the new data inserted. How can I do that
using SQL?

Try:

DELETE *
FROM TempTable;

Be aware of database bloat, though. Make sure that the database is
compacted frequently after deleting many records in tables.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. (Only "Answers" have green
check-marks.) Remember that the best answers are often given to those who
have a history of rewarding the contributors who have taken the time to
answer questions correctly.
 
True, if I'm not mistaken though there is a way to compact a database
via code. I've never done it so I'd have to dig into help. I believe
that the syntax is CurrentDatabase.Compact but NOT certain.
 
David C. Holley said:
True, if I'm not mistaken though there is a way to compact a database
via code. I've never done it so I'd have to dig into help. I believe
that the syntax is CurrentDatabase.Compact but NOT certain.

Not exactly. It's complicated, if you're using Access 97; easy if
you're using Access 2000 or later. See this link:

http://www.mvps.org/access/general/gen0013.htm
Why CompactCurrentDatabase doesn't work from code
 
Back
Top