• marg 14154 (7/14/2014)


    I am trying to import a text file to a SQL server table using SISS. I use SSIS but this is my first time in import this type. Please HELP!

    ---------------text file--------------

    REQ que stn all

    STN

    DN 326 0000

    LOC GHUT ILCE 01 2 12 01

    OPT CFW 1MR DGT RTP 0 ALTO NACT AWS NACT !NPA CFB CFD ENQC

    CFAN

    STN

    DN 326 0001

    LOC GHUT ILCE 01 2 12 02

    OPT SUS CFW 1MR CWT DGT RTP 0 ALTO 3261281 ACT AWS NACT !NPA !ECO !RIT !124 CFB

    CFD VM ENQC

    STN

    DN 326 0003

    LOC GHUT ILCE 03 2 16 14

    OPT 1MR DGT RTP 0 !TKD CFB CFD

    STN

    DN 326 0004

    LOC GHUT ILCE 03 2 19 20

    OPT 1MR DGT RTP 0 !LOC CFB CFD

    -------------------------------------------------------------

    1. The header "REQ que stn all" is to be disregarded

    2. STN disregarded meaning not be included in the destination table

    3. DN disregarded

    4. 7 digits number after DN eg, 326 0000 is the phone number, first column

    5. LOC disregarded

    6. GHUT i.e. the next after LOC is the second column and that the Station Code

    7. The set of codes after GHUT, eg 'ILCE 01 2 12 01' is one column and that is the Port.

    8. OPT is disregarded.

    9. the Codes after OPT eg, 'CFW 1MR DGT RTP 0 ALTO NACT AWS NACT !NPA CFB CFD ENQC

    CFAN' to be treated as individual separate columns.

    Thanks,

    I don't think the file is poorly formatted, it looks consistent, free of funny characters:w00t: and relatively human readable.

    First thought is to import the file, line by line, into a staging table and then use DelimitedSplit8K[/url] to parse it, straight forward and quite fast.

    😎