Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 12 Aug 2010 @ 22:14:12 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: BTEQ import specified columns
 
From:   Geoffrey Rommel

  It would save time if I could import just the required fields from the original csv (which has 18 columns without headings).  


And now for something completely different...

     #perl
     $infile = shift;

     @csv_contents = read_csv($infile);
     # read_csv is a subroutine (not shown here) that reads the CSV, handles the
     # separation of fields, quoting, etc., and returns a list of lists containing
     # the data you want to load.

     use Teradata::SQL;  # or DBD::ODBC if you prefer
     $dbh = Teradata::SQL::connect("mrbig/hbogart,xxxx");
     $ins = $dbh->prepare("insert into xxx.yyy (?,?,?,?,?,?,?,?)");

     foreach $csv (@csv_contents) {
        $ins->executep($csv);
     }

     $dbh->disconnect;

That didn't hurt a bit, did it?



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023