in reply to Data insert into DB
Well, this is really more of a SQL Server / T-SQL question than a Perl question. From the example data you provided and the amount of time it takes, it appears that you either use referential integrity (primary/foreign keys) and/or triggers for a set of tables...
- Your file looks to be in a delimited format. Why not just use native bcp?
- How long does it take for the inserts to run when using isql?
- You're inserting one row at a time. One row per transaction. Is there a reason why you can't insert say 1,000 rows at a time before your execute()?
- Instead of using single quotes for adding your data, use $dbh->quote($string) as there is no guarantee that your data file won't have embedded quotes that could mess up the insert. You may want to use $query = sprintf "INSERT INTO SOWND1 values(%s)", $dbh->quote($data[$j]); $dbh->do($query);
Don't be too quick to blame Perl here.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Data insert into DB
by mje (Curate) on Aug 10, 2011 at 15:21 UTC | |
by jfroebe (Parson) on Aug 10, 2011 at 15:24 UTC |
In Section
Seekers of Perl Wisdom