Hi everyone,
i was recently given an assignment to write a program in visual basic 6 which reads in a textfile's path, a database table, and a 'field map', a delimited char, and a couple other parameters which aren't important to this discussion.
Now, what this program's task to do is: import the values in the text file to the SQL 2k database table based on the 'field map'. This 'field map' basically will come in the form of, for example, 1=2, 3=4 (ie, column 1 in the text file goes in column 2 in the table, column 3 in the text file goes in column 4 in the table, ect).
So far i have created a BulkInsert Task object and i am able to import data into the table when there is an exact mapping, but i'm stuck on the 'field mapping' part. Originally, i was going to execute a stored procedure to the bcp to create a format file, but decided against this. Next i was just going to create my own 'format file' class in visual basic and build my own format file from scratch, but i think there HAS to be an easier solution.
So, i guess..basically, my question is this: Is there anyway to dynamically create a format file in a relatively 'painless' manner?
Thanks for the help!

MKoslof

04-19-2004, 06:42 AM

Here is a good place to start for DTS development.

Http://sqldts.com

Do you have any current code started? If so, can you post it. Do you want to do the majority of the work through VB or SQL Server? I prefer doing most of my DTS work natively, but you can fire most of the scripting you need directly from VB.