Importing a flat file with DTS

  • I have the a text file with the structure :

    A

    1 10 20

    2 15 25

    B

    4 40 100

    C

    1 2 3

    I need make a DTS package that import these lines to a table in SQL SERVER 2000 e be record in the folow way :

    A 1 10 20

    A 2 15 25

    B 4 40 100

    C 1 2 3

    I have not much experience in DTS packages and ask for some help in this.

    Thank you for any help.

    Alvaro

  • Personally I'd use an Active X task to do this. Read line by line and parse them to determine what to do. This would be complicated since you would load a line, look for a single field and then "save" that value.

    Load another line and if it's not a single fields, do an insert. Otherwise, save the new value.

    repeat until eof.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

  • Yep...I agree with Steve. The only other solution that comes to mind is to bring your data into a table in SQL Server and, using a cursor, walk through row by row and essentially do the same thing you would do with Steve's methodolgy. I guess it depends on how much data you will bring in at a time, any time constraints you have on the import, and how comfortable you are writing script versus using a cursor in sql.

    hth,

    Michael

    Michael Weiss


    Michael Weiss

  • and how could i make a vbscript to transform the frist text file in another text with that configuration ?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply