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:
My questions are.
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.
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)
Many thanks in advance,
Dan