Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2013
    Posts
    4

    Unanswered: defining import columns in DB2 table from flat file

    Hi,

    I want to import data to db2 table but only for few columns that are defined in a separate flat file.
    please help

  2. #2
    Join Date
    Nov 2004
    Posts
    67
    Try
    Import from flat_file_name ... insert into your_table_name (column_name(s) you want to import)

  3. #3
    Join Date
    Jun 2013
    Posts
    4
    Quote Originally Posted by CCMF View Post
    Try
    Import from flat_file_name ... insert into your_table_name (column_name(s) you want to import)
    Hi,

    In the above code we will have to have a fixed structure of source file i.e. the column names should be fixed.
    But in our case the source can be subset of columns defined in target.
    example,

    target tale structure:
    Column1,column2,column3,column4,column5,column6

    source file 1 structure:
    column1, column3,column5

    source file 2 structure:
    column4,column5,column6

    source file 3 structure:
    column3, column6

    so on and so forth

    Thanks in advance

  4. #4
    Join Date
    Nov 2004
    Posts
    67
    For all sources:
    You have to define the flat file type and, if it has a file delimiter, the delimiter also.
    Examples:

    import from your_file_name of del modified by coldel; insert into ...
    import from your_file_name of ixf insert into ...

    Now to your scenarios:

    source file 1 structure:
    import from your_file_name ... insert into your_table (column1, column3,column5)

    source file 2 structure:
    import from your_file_name ... insert into your_table (column4,column5,column6)

    and so on ...

Posting Permissions

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