Skip to Content.
Sympa Menu

freetds - Re: [freetds] How to do bulk updates

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How to do bulk updates
  • Date: Tue, 4 Mar 2003 00:02:35 -0500

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.
>
> One way is to use "instead of" triggers, but is this a good way ?

Well, it's not a FreeTDS question, but OK.

Definitely don't use triggers.

I take it you have a bunch of rows in a table, and a file consisting of
updated information for those rows. The least-effort technique is:

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 have more than, say, 100,000 rows to do, you might want to put #3
in a loop and limit the transaction size that way. The maximum reasonable
transaction size is determined by the hardware, and to some extent by the
row size.

If any of the above is unclear, ask again. :-)

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page