[thelist] SQL Update

Ken Moore psm2713 at hotmail.com
Sat Jul 3 11:23:16 CDT 2004


Hi all,


Jason Robbins


>Hey
>
>[On an] SQL DB,  I have been wondering though in the interests of good 
>coding and such should I only be updating the fields that have actually 
>changed?

No. For 2 reasons. First, it is not good coding practice. It is redundant. 
("Hi, I am from the Department of Redundancy Department.")  Second,. for the 
sake of internal documentation, only update the fields that have changed.

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.

Actually, for your purposes, this last idea may be a very good solution 
since you seem to have many fields to update. In a single call, you may save 
yourself many lines of code – and many typos – in loading and saving data. 
And in many cases, it might be faster because everything is done in one 
operation.

Ken

_________________________________________________________________
MSN Toolbar provides one-click access to Hotmail from any Web page – FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/



More information about the thelist mailing list