Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2012
    Posts
    3

    Unanswered: Loading of data from 2 csv's with join on a column?

    Hi All,

    This is my first post in dbforums Thanks to All the folks for helping beginners like me.

    So talking about my issue. we recently got a task to load a table with information having from 2 csv's ( this is a result of 2 tables, 1 from db2 and 1 rom oracle )

    CSV1:
    site,region

    CSV2:
    region,ID

    I would like to have a result table as

    Result:
    site,region,ID

    Could you tell a way to get the result with a join on region? Thanks in advance.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    the best would be to create 2 work tables in which you load the csv files
    execute a query based on a join over these to populate the final target table
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Feb 2012
    Posts
    3

    Thumbs up

    Hi,

    Thanks for your reply, we dont want to create extra table as we already have so many.

    Anyway we are planning to populate the data into 2 csv's and then joining the rows based on common column through shell code.

    Waiting for other ways if possible

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by msp2244 View Post
    we dont want to create extra table as we already have so many.

    Anyway we are planning to populate the data into 2 csv's and then joining the rows based on common column through shell code.

    Waiting for other ways if possible
    Since you seem to be looking for the least efficient way of doing this, may I suggest printing the two files on paper then using scissors and glue to join them.

  5. #5
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Quote Originally Posted by msp2244 View Post
    Hi All,

    This is my first post in dbforums Thanks to All the folks for helping beginners like me.

    So talking about my issue. we recently got a task to load a table with information having from 2 csv's ( this is a result of 2 tables, 1 from db2 and 1 rom oracle )

    CSV1:
    site,region

    CSV2:
    region,ID

    I would like to have a result table as

    Result:
    site,region,ID

    Could you tell a way to get the result with a join on region? Thanks in advance.
    At this point in time, such a feature is not available in DB2.


    Cheers
    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  6. #6
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Deleted.
    Because, I didn't saw and understood OP's requirements throughly.
    Last edited by tonkuma; 02-16-12 at 22:48.

  7. #7
    Join Date
    Jan 2009
    Location
    Zoetermeer, Holland
    Posts
    746
    Quote Originally Posted by msp2244 View Post
    we dont want to create extra table as we already have so many.
    Strange argument, but you could use temp-tables... they do not count, do they?
    Quote Originally Posted by msp2244 View Post
    Waiting for other ways if possible
    try this:
    write in perl
    use DBI/DBD::CVS and code your join in Perl. The result set can inserted into DB2.

    Please let me know if that works

Posting Permissions

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