Click to See Complete Forum and Search --> : deleting DataBase


RayA
September 28th, 2001, 12:02 PM
I am using VB6 to maintain Access 2000 tables. I need to delete tables and repopulate them with data from our main. Our customer table is 25,000 records and the only way I have found to delete the table is to go through the records one by one and delete them. The delete process on this one table alone takes about 30 minutes.

Is there a way to copy the table setup (variables, relationships etc), delete the entire table and recreate it using the copy?

Thanks in advance.

Ray

Cakkie
September 28th, 2001, 12:13 PM
I can't give you an answer to the copy/create stuff, but you can delete all the records from a table using a SQL statement:

DELETE FROM myTable
DELETE * FROM myTable



If the first one (without the *) shouldn't work, use the second, but normally, it should work, and leave you with an empty table.

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook

RayA
September 28th, 2001, 04:07 PM
I am using adodc and I can't find any command to execute a sql. Everything I read says db.execute, but, I can't find an execute.

It seems like I can use Delete with a filter, but, I haven't been able to figure out how to use it. The help has no examples of deleting an entire table.

I have tried:

db.filer = "DELETE * FROM mytable"
db.delete adeffectgroup
db.updatebatch

the filer statement gets an error.
Do you know how to use filer/delete.

Thanks in advance

d.paulson
September 28th, 2001, 09:00 PM
Can't you use SQL?

dim strSQL as string
strSQL = "DELETE * FROM YourTable"
cnYourConnection.execute strsql

It should process faster, probably less than 10 sec.


David Paulson

d.paulson
September 28th, 2001, 09:16 PM
With the adodc control this seems to work

Adodc1.RecordSource = "DELETE * FROM YourTable"




David Paulson