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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access Equivalent to SQL's Truncate Table



 
 
Thread Tools Display Modes
  #1  
Old August 5th, 2004, 12:40 PM
Paul
external usenet poster
 
Posts: n/a
Default Access Equivalent to SQL's Truncate Table

Hi Guys, can anyone help?

Is there an access equivalent to SQL's truncate table
command? I need to very quickly delete all records from a
table but keep the structure of the table. Running a
delete query takes a very long time as there are
thousands of records. I know I could just copy the
structure of the table to a different name, delete the
table and rename the copy but I'm trying to automate the
process and want to avoid it if I can due to table
relationships.

Any help will be greatly appreciated.

Many Thanks
Paul
  #2  
Old August 5th, 2004, 11:25 PM
Tim Ferguson
external usenet poster
 
Posts: n/a
Default Access Equivalent to SQL's Truncate Table

"Paul" wrote in
:

I need to very quickly delete all records from a
table but keep the structure of the table. Running a
delete query takes a very long time as there are
thousands of records.


A plain and simple

Currentdb().Execute "DELETE FROM TempTable;", dbFailOnError

takes too little time to count on 320k records -- how big is your table and
how much of a hurry are you in? For comparison, it takes about 100 seconds
to fill it up again with a simple DAO.Recordset.AddNew loop -- this is a
pretty aged 700 MHz system, so a more recent processor would cut times
greatly.

B Wishes


Tim F





  #3  
Old August 6th, 2004, 06:20 AM
TC
external usenet poster
 
Posts: n/a
Default Access Equivalent to SQL's Truncate Table


"Tim Ferguson" wrote in message
...
"Paul" wrote in
:

I need to very quickly delete all records from a
table but keep the structure of the table. Running a
delete query takes a very long time as there are
thousands of records.


A plain and simple

Currentdb().Execute "DELETE FROM TempTable;", dbFailOnError

takes too little time to count on 320k records -- how big is your table

and
how much of a hurry are you in? For comparison, it takes about 100 seconds
to fill it up again with a simple DAO.Recordset.AddNew loop -- this is a
pretty aged 700 MHz system, so a more recent processor would cut times
greatly.



"DELETE FROM table" used to be slow in earlier versions, because it
literally deleted every record individually. It was optimized in Access 97
(I think) to do it more efficiently. Perhaps he's using an old version.

TC


  #4  
Old August 11th, 2004, 10:33 AM
external usenet poster
 
Posts: n/a
Default Access Equivalent to SQL's Truncate Table

Thanks for your help guys, i'll give that a try. It is
part of a whole string of deletes and imports that I need
to do and it was taking longer than I'd anticipated but
hopefully this speed things up. I'm deleting about 10,000
records at a time.

Thanks again
Paul


-----Original Message-----

"Tim Ferguson" wrote in message
6...
"Paul" wrote in
:

I need to very quickly delete all records from a
table but keep the structure of the table. Running a
delete query takes a very long time as there are
thousands of records.


A plain and simple

Currentdb().Execute "DELETE FROM TempTable;",

dbFailOnError

takes too little time to count on 320k records -- how

big is your table
and
how much of a hurry are you in? For comparison, it

takes about 100 seconds
to fill it up again with a simple DAO.Recordset.AddNew

loop -- this is a
pretty aged 700 MHz system, so a more recent processor

would cut times
greatly.



"DELETE FROM table" used to be slow in earlier versions,

because it
literally deleted every record individually. It was

optimized in Access 97
(I think) to do it more efficiently. Perhaps he's using

an old version.

TC


.

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Name not showing ID is René Setting Up & Running Reports 11 June 29th, 2004 01:40 AM
Newbie? Do I use Report or Query John Egan New Users 11 June 28th, 2004 08:31 PM
Access 2002: Linking table indices George Fowler Database Design 2 June 11th, 2004 12:34 AM
Corrupt Access '97 Table Mike C. Database Design 2 June 9th, 2004 06:21 PM
How to extract data from multiple Access databases to create a Pivot table Android Worksheet Functions 4 February 6th, 2004 03:22 PM


All times are GMT +1. The time now is 01:40 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.