dbTalk Databases Forums  

ActiveX Script to import flat file

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ActiveX Script to import flat file in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Anthony
 
Posts: n/a

Default ActiveX Script to import flat file - 03-26-2005 , 02:41 PM






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

Anthony

Reply With Quote
  #2  
Old   
Jason Johansen
 
Posts: n/a

Default RE: ActiveX Script to import flat file - 04-21-2005 , 03:58 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.

"Anthony" wrote:

Quote:
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

Anthony


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.