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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |