Board index » delphi » The optimised way to insert data into table

The optimised way to insert data into table


2006-10-05 03:23:32 PM
delphi70
I need to insert data to table by the usual way as follows:
LOOP_CLOCKDATE=ISTARTDATE;
while (LOOP_CLOCKDATE<=IENDDATE) do
begin
insert into attendrec
(EMPLOYEEID,CLOCKDATE)
values
(:MEMPLOYEEID,:LOOP_CLOCKDATE);
LOOP_CLOCKDATE = LOOP_CLOCKDATE +1;
end
end
It takes 1min2sec to insert 40021 records. Any faster method?
Benson
 
 

Re:The optimised way to insert data into table

A stored procedure will likely be faster.
--
Bill Todd (TeamB)
 

Re:The optimised way to insert data into table

Thanks. My code was copied from stored procedure.
Benson.
"Bill Todd" <XXXX@XXXXX.COM>׫]„:452516fe$XXXX@XXXXX.COM...
Quote
A stored procedure will likely be faster.

--
Bill Todd (TeamB)
 

Re:The optimised way to insert data into table

You can try to disable (or drop) indexes before group insertion and
after your procedure completes re-enable them (create once again). This
would prevent a db engine from re-building index structures after any
single insert,
mk