Use an array of bind vars. ----------------- Ron Reidy Lead DBA Array BioPharma, Inc.
-----Original Message----- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 07, 2004 2:04 PM To: [EMAIL PROTECTED] Subject: Large SQL statements... 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 This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.