|
|
Archives of the TeradataForum
Message Posted: Thu, 12 Aug 2010 @ 22:14:12 GMT
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?
| |