all groups > sql server dts > march 2005 >
You're in the

sql server dts

group:

ActiveX Script to import flat file


ActiveX Script to import flat file anthony.boud NO[at]SPAM ccsit.co.uk
3/26/2005 12:41:50 PM
sql server dts:
I have a fixed length text file that I wish to import into SQL tables.

The text file will contain 2 different types of records. Firstly, a
header record, which is immediately followed by X number of detail
records.

Each record is 80 characters long, separated by a CRLF, and the type
of record is identified at the beginning (first 2 char's).

I would like to insert the header records into a header table,
returning the unique ID (auto incrementing ID) of the row inserted
into the header table, which will be used when inserting the
associated detail records.

Does anybody have any sample ActiveX scripts that do something similar
to the above?

Basically, I'm after an example script that opens a file, loops around
each row in the file and tests the data in some means.

Any examples would be absolutely fantastic and much appreciated!

Many thanks

RE: ActiveX Script to import flat file Jason Johansen
4/21/2005 1:58:02 PM
I am looking for the same thing and would be interested if you found a
solution. I am new to SQL server/DTS and want to do a similar thing.

We have 3 record types in one file and each one needs to go to it's own table.

I think I can code this in an ActiveX script, but I need to figure out how
to define columns in a TEXT file for each reacord type HDR_COL1, HDR_COL2,
DET_COL1, DET_COL2, etc.

That is where I am hung up now.

[quoted text, click to view]
AddThis Social Bookmark Button