I have a table with 22 columns, and my INSERT on this table is
actually putting in data to possibly all 22 fields. My question is, is
there a better way to write this INSERT? Here's what I have:
while ($line = <DATA>) {
$csv->parse($line);
@data = $csv->fields;
$sth = $dbh->prepare(qq{INSERT INTO AllMid_Data
VALUES(?,?,?,?,?,?,?,?,?,?,?,?
,?,?,?,?,?,?,?,?,?,?)}) or print "Error with INSERT _prepare_:
$DBI::errstr\n";
$sth->execute(undef,$data[0],$data[1],$data[2],$data[3],$data[4],$data[5
],$dat
a[6],$data[7],$data[8],$data[9],$data[10],$data[11],$data[12],$data[13],
$data[14
],$data[15],$data[16],$data[17],$data[18],$data[19],$data[20]) or print
"Error with
INSERT _execute_: $DBI::errstr\n";
}
The 'execute' statement is quite long, and almost all of the
data comes from a single array. I don't think this is a big deal in and
of itself, just looking for a better way to do this. Thanks.
Scott Nipp
Phone: (214) 858-1289
E-mail: [EMAIL PROTECTED]
Web: http:\\ldsa.sbcld.sbc.com