Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Unanswered: Newbie has problem on Importing data

    I met a problem to import the data from a text file if the data value starting with space


    Content of the data file for import - abc.txt
    Line1: ABC~ 123456789~123 <== Contains space at FLD_B
    Line2: DEF~0123456789~456

    Syntax for the import
    db2 IMPORT FROM abc.txt OF DEL MODIFIED BY CHARDEL^ COLDEL~ METHOD P "(1, 2, 3)" MESSAGES abc.msg
    "INSERT_UPDATE INTO myschema.tbl1 (FLD_A, FLD_B, FLD_C)"

    Result after importing abc.txt into myschema.tbl1
    FLD_A FLD_B FLD_C
    ABC 123456789 123 <== Space at FLD_B has gone
    DEF 0123456789 456

    Please help!

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Surprise, surprise!

    IMPORT ... MODIFIED BY KEEPBLANKS ...

  3. #3
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    You can use the "keepblanks" file type modifier

    http://publib.boulder.ibm.com/infoce...e/r0011045.htm

    example :
    db2 "import from x.txt of del modified by keepblanks insert into timp"


    Cheers
    Sathyaram

    Quote Originally Posted by KeeOn
    I met a problem to import the data from a text file if the data value starting with space


    Content of the data file for import - abc.txt
    Line1: ABC~ 123456789~123 <== Contains space at FLD_B
    Line2: DEF~0123456789~456

    Syntax for the import
    db2 IMPORT FROM abc.txt OF DEL MODIFIED BY CHARDEL^ COLDEL~ METHOD P "(1, 2, 3)" MESSAGES abc.msg
    "INSERT_UPDATE INTO myschema.tbl1 (FLD_A, FLD_B, FLD_C)"

    Result after importing abc.txt into myschema.tbl1
    FLD_A FLD_B FLD_C
    ABC 123456789 123 <== Space at FLD_B has gone
    DEF 0123456789 456

    Please help!
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  4. #4
    Join Date
    Feb 2006
    Posts
    2

    Talking

    Oh! It works! Thanks you all!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •