Import multi row text file into one row table

  • I am developing a database for a travel agency, and most of the airline tickets are provided in a text file format. I need to automate the transfer of these files into the database. Below is an example of a ticket file that contains the passenger name, ticket pricing information, destinations.

    Any help will be most appreciated

    AIR-BLK206;7A;;225;2400008022;9E11767011;001001

    AMD 2400049973;1/1;             

    GW2098691;9E11767011

    MUC1A 2V32RW021;0101;CAIC3210H;90203013;CAIC3210H;90203013;CAIC3210H;90203013;CAIC3210H;90203013;;;;;;;;;;;;;;;;;;;;;

    A-ALITALIA;AZ 0556

    B-TTP/PT/RT

    C-7906/ 3010ASSU-3010ASSU-I-0

    D-050309;050324;050324

    G-X  ;;CAICAI;

    H-005;002OCAI;CAIRO            ;FCO;ROME FIUMICINO   ;AZ    0897 M M 02APR1425 1755 02APR;OK01;HK01;;0;321;;;20K;2 ;;ET;0330 ; ;1334

    H-006;003OFCO;ROME FIUMICINO   ;CAI;CAIRO            ;AZ    0896 K K 12APR1005 1325 12APR;OK01;HK01;;0;321;;;20K;C ;;ET;0320 ; ;1334

    K-FEGP4550.00    ;;;;;;;;;;;;EGP5166.00    ;;;  

    KFTF; EGP100.00   EG TR; EGP150.00   XK EM; EGP74.00    QH EB; EGP6.00     EQ GO; EGP11.00    XL TI; EGP86.00    YQ TO; EGP16.00    EX AE; EGP8.00     HB CO; EGP65.00    IT EB; EGP14.00    VT SE; EGP86.00    YQ VO;;;;;;;;;;;;;;;;;;;

    L-

    M-MLEEEG9        ;KLSXEG        

    N-NUC446.80;335.10

    O-XX02JUN;06APR02JUN

    Q-CAI AZ ROM446.80AZ CAI335.10NUC781.90END ROE5.819100

    I-001;01YOUNIS/MOHAMED MR;;APSEE RC;;

    T-T055-5123299938

    FEAZ/NONENDO/CHGRET PERMITED;S2-3;P1

    FM*P*5;S2-3;P1

    FPCASH

    FVAZ

    TKOK21MAR/CAIC3210H

  • Certainly not an envious task.

    Does the text file always appear in the same format. IE The same number of lines, the text a consistent type?

    If so, you may have a chance of converting this into an xml file using an xml file template. That way, you can bring it on like a normal xml file.

    I am not an advocate of xml, but this would be an ideal method to help you.

    You can download many free xml tools. Try this one.

    http://www.xmlcooktop.com/

    Please let us know how you get on.


    ------------------------------
    The Users are always right - when I'm not wrong!

  • Unfortunately, the number of lines is not consistent as well as the text, what is consistent is only the two letters abreviations e.g.K-FEGP4450 means the cost of the ticket in Egyptian Pounds (EGP)

  • I cannot see how it is possible unless the format is consistent.

    The only thing you can do is to read each line out of the text file and insert into a column. Then use some logic to go through each column trying to identify the type of line it is.


    ------------------------------
    The Users are always right - when I'm not wrong!

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

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