[freetds] How to do bulk updates

Anwar, Mohammed mohammed.anwar at intel.com
Tue Mar 4 10:33:05 EST 2003


Thanks for your responses..
I will try these out.

Anwar

-----Original Message-----
From: Martin Spott [mailto:mas at plesnik.de]
Sent: Tuesday, March 04, 2003 7:01 AM
To: FreeTDS Development Group
Subject: Re: [freetds] How to do bulk updates


On Tue, Mar 04, 2003 at 12:02:35AM -0500, James K. Lowden wrote:
> On Mon, 3 Mar 2003 17:45:46 -0800, "Anwar, Mohammed" <mohammed.anwar at intel.com> wrote:

> > I was wondering what is the best way to implement bulk updates.
> > I have a large number of updates to do.

> 1.  create a table suitable for bulkloading your file.  
> 2.  Use freebcp to load that table.
> 3.  "update tgt from src set data = src.data where tgt.key = src.key".

If you like to be proud of your solution, then create a nice Perl script
that connects to the Database with DBI/DBD-Sybase or Sybperl and execute an
update statement for each row. Better you remove old rows that get replaced.
I've done such stuff and it works quite well even vor tables wit several
million rows (o.k., it takes few hours  ;-)

Martin.
-- 
 Unix _IS_ user friendly - it's just selective about who its friends are !
--------------------------------------------------------------------------


More information about the FreeTDS mailing list