I could use some suggestions / ideas.
I wrote a console application that queries all data from a table in MS Access (I know, but I inherited it) to a SQL table. It runs every morning as a scheduled task. The fields between the two tables are not identical. Currently I select all data from the MS Access table, loop through the dataset and insert each row into the SQL table. I also write a quick log file in the process. It works, but it’s not fast. I would appreciate any ideas that you may have to improve the process.
Thanks!
I could use some suggestions / ideas. I wrote a console application that queries
Share
SqlBulkCopy Class
It’s way faster than individual
insertstatements.You have to increment your own identity field value for the primary key. To do that, first grab the last identity field value where you left off:
select top 1 id_customerfrom customers
order by id_customer desc
Then increment an
intvariable as you loop through yourDataSet.Or you can use GUID for primary key column instead.
Example code for using SqlBulkCopy:
Strongly Typed DataTable: