Dan_T4
08-05-2011, 02:27 AM
Hi, I have an Access 2010 with an SQL Server 2008 back end.
A couple of times a week I have cause to append from a local table between 100 and 6000 records to a table in the SQL Server
The SQL server table has a number of fields and each append requires different combinations of these. Sometimes I append to fields x,y & z and other times a,b & z.
In addition to this, dependent on criteria I may add an incremented integer value to certain records when I append them. Others I dont.
Originally (to get it working) I simply used a DAO recordset and looped through the local table adding records to a criteria to mapped fields in the SQL Server table. This is ok on the small runs but for 6k records it takes between 30-50 minutes.
I am looking to improve performance and have tried:
Looping local table and using QueryDef to change the statement in a Passthrough then executing it.
Creating a Stored Procedure, opening a ADODB connection, looping the local table changing the statement and excuting it.
Exporting the local table to SQL Server and then using a Stored Procedure to append to the Main table. This worked quickly but I didnt know how to add the conditional incremented value.
I have attempted these on a test version of the table for 100 records and the response in both cases are still not particularly quick.
My questions are.
For what I am trying to do which approach would be best.
Should I be looking at my tables for the append performance improvements.
Is it possible to do this without the loop with a server function (not that I have experience of these)
I have searched the forum but not found a specific answer that helps point me in the right direction. If I have missed a post then appologies and please point me too it.
Many thanks in advance,
Dan
A couple of times a week I have cause to append from a local table between 100 and 6000 records to a table in the SQL Server
The SQL server table has a number of fields and each append requires different combinations of these. Sometimes I append to fields x,y & z and other times a,b & z.
In addition to this, dependent on criteria I may add an incremented integer value to certain records when I append them. Others I dont.
Originally (to get it working) I simply used a DAO recordset and looped through the local table adding records to a criteria to mapped fields in the SQL Server table. This is ok on the small runs but for 6k records it takes between 30-50 minutes.
I am looking to improve performance and have tried:
Looping local table and using QueryDef to change the statement in a Passthrough then executing it.
Creating a Stored Procedure, opening a ADODB connection, looping the local table changing the statement and excuting it.
Exporting the local table to SQL Server and then using a Stored Procedure to append to the Main table. This worked quickly but I didnt know how to add the conditional incremented value.
I have attempted these on a test version of the table for 100 records and the response in both cases are still not particularly quick.
My questions are.
For what I am trying to do which approach would be best.
Should I be looking at my tables for the append performance improvements.
Is it possible to do this without the loop with a server function (not that I have experience of these)
I have searched the forum but not found a specific answer that helps point me in the right direction. If I have missed a post then appologies and please point me too it.
Many thanks in advance,
Dan