[thelist] SQL Update CORRECTION

Ken Schaefer ken at adOpenStatic.com
Sun Jul 4 20:22:07 CDT 2004


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Jason Robbins" <evolt at whisky-fudge.org.uk>
Subject: Re: [thelist] SQL Update CORRECTION


: Ken Moore wrote:
: >> There is one exception, that is if you have two functions (for
: >> example, "scatter_tablename" and "gather_tablename") where one line
: >> loads all fields into variables and the other saves all variables into
: >> the table. Even then, in your calling procs, only update the data that
: >> has changed.
: The only trouble with that is it means writing ever different
: possibility as a stored procedure - unless someone knows a trick to
: solve this problem?
:
: Jas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What is the scale of this application? If it's just a two-tier application,
I would write just the one sproc, and update all the fields with the new
values (changed or not).

Writing lots of sprocs to cater for lots of different possible updates does
not sound like a good way to spend your time. The alternative is that you
somehow get the original values (either via another extraction from the
database, or by persiting the original value someonwhere), and compare those
to the new values, and update the record with the values that have changed.
Again, for a simple app, this seems more work than necessary.

Obviously YYMV and you'll need to make a call based on your application's
requirements.

Cheers
Ken



More information about the thelist mailing list