Friday, February 17, 2012

Different access files DTS to mssql

We use a program that creates a access database for each of our payperiods. Its a pain to get a full history of a person from each one. I want to setup a way I can combine all of the access files into one table in mssql. I have a DTS I created into a .bas file. My plan is to make the vb.net code get a directory of the files, then run a function (the .bas file) on each directory appending the access table to the mssql table. The struckture of the access files are that each file is in its own directory, like below:

\\servername\TA\company\07-25-04\Trans.mdb
\\servername\TA\company\08-08-04\Trans.mdb
\\servername\TA\company\08-22-04\Trans.mdb

The table is called "Transactions" and they are the same in each mdb file in terms of fields. Every two weeks there is a new directory that is added to the company directory. So I can either dump all and append all, or only append new data and only use the dump/append when there is a problem.

I am just not sure how to do that. Any ideas?Since the structure of each of the .MDB files is the same, it sounds to me like a DTS package using a Global Variable would be a good solution. The Global Variable would be used for the name of the Access file to import. Your VB.NET code would loop through the files to process, feeding DTS the name of each file one by one via a Global Variable.

You might consider keep a SQL table of the files you have processed so your VB.NET program can check against that to see if it has already processed and given file.

Terri|||Sounds good....... how do I do that?|||Okay, I have some code in vb.net to get each date from a startdate. I made a DTS and exported it into a VBS file. How doI get that code to run in my VB.net solution? The vbs file has amain() and some other subs. Just not sure how to referenceit. (I can post the vbs script if needed)

No comments:

Post a Comment