Re: Efficient select/insert




----- Original Message ----- From: "Philip M. Gollucci" <pgollucci@xxxxxxxxxx>
To: "Jonathan Mangin" <jon.mangin@xxxxxxxxxxx>
Cc: <dbi-users@xxxxxxxx>
Sent: Tuesday, April 26, 2005 3:19 PM
Subject: Re: Efficient select/insert



Jonathan Mangin wrote:

I would like to select several rows from one table
and insert them into another nearly identical table
using Perl/DBI:

my @array = $q->param();  # HTML checkboxes

foreach my $element (@array) {

$dbh->do("INSERT INTO t (col1, ...) SELECT col1, ... FROM t2 WHERE x = '$element'");
}


--
END
-----------------------------------------------------------------------------
Philip M. Gollucci
Senior Developer - Liquidity Services Inc.
Phone:  202.558.6268 (Direct)
E-Mail: pgollucci@xxxxxxxxxxxxxxx
Web:    http://www.liquidation.com



oh
That's graceful. Thanks.

So to loop through ~150 tiny rows is probably no hardship
on the db engine.(?)

--Jon


.



Relevant Pages

  • Re: need some help with I/O
    ... >> I will work on a graceful way to exit the loop. ... Providing a graceful exit from the loop may greatly reduce the ... the fflush or change the buffering mode to line buffering. ...
    (comp.lang.c)
  • Most efficient way to transfer OdbcDataReader to sql server
    ... I havent seen anyway to transfer the data over to sql server in a graceful ... I have to generate sql statements dynamically or loop through each ... meaning I cant create a DSN. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: need some help with I/O
    ... "Les Coover" wrote: ... > I will work on a graceful way to exit the loop. ...
    (comp.lang.c)
  • Re: need some help with I/O
    ... >> The endless loop is supposed to be that way so that ... > while loop ends, the output file is closed, and your ... Yes, I will work on graceful way to exit the loop, hopefully that will solve ...
    (comp.lang.c)