Re: Delete record in batch mode
- From: "Del Murray" <Del.Murray@xxxxxxxxxxxxxx>
- Date: Mon, 28 May 2007 21:14:44 -0500
If you dont include a unique key from each table that you want to edit
(including delete) then most database drivers have to read every record in
the table to try an determine which record **might** be the one that you
want updated or deleted. I say **might** becuase there may be more that one
record which has identical column data and then the database manager can
tell which particular (unique) record is the one that you *really* want to
update or delete. Most Access databases tend to be small and this phenomena
goes unnoticed but with large tables in MS Sql it will start to run slow or
fail completely.
e.g. lets say you have an invoice table and you select the following columns
from 6 rows ...
InvoiceNumber, InvoiceDate, TransCode, Amount
000001, 1/2/2007, CR, 1500.00
000001, 1/2/2007, CR, 1500.00
000001, 1/2/2007, CR, 1500.00
000001, 1/2/2007, CR, 1900.00
000001, 1/2/2007, CR, 2000.00
000001, 1/2/2007, CR, 2200.00
This is now in your ADO record set.
Then you change the "amount" on the third record to 1850.67
Then you call "updatebatch" ...
Which physical record in the actural database would you expect the the
database manager to update ???
He cant telll because ther were 3 records in the ADO Recordset and they
didnt' have any unique identifiers that he could you to determine exactly
which record was to be updated in the actuual database.
you **MUST** select a unique key from every row that you want to update or
delete and then, if it is a joined recordset you ** MUST** tell the database
manager, which table you want the updates to apply to .. he does not
automatically update all of the tables that were in the join, he updates
only one of them and if you dont let him know which one it is, he cant do
the job right.
.
- References:
- Delete record in batch mode
- From: Cavalera Guido
- Re: Delete record in batch mode
- From: Cavalera Guido
- Re: Delete record in batch mode
- From: Brian Bushay TeamB
- Delete record in batch mode
- Prev by Date: Re: Delete record in batch mode
- Next by Date: Re: Delete record in batch mode
- Previous by thread: Re: Delete record in batch mode
- Next by thread: Re: Delete record in batch mode
- Index(es):
Relevant Pages
|