× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I seem to recall hearing that the DB was smart enough to not do an update
if nothing actually changed.

Though there appears to be some caveats to that. I tested a table with a
row change timestamp and the TS was changed. I'd assume that a
before/after update trigger would also force the DB to make the change.

Note I've seen the "no change update" in old code to release the lock on
the record. Either READ(N) wasn't available originally or the developer
didn't know about it.

Charles


On Wed, Jun 11, 2014 at 10:13 AM, Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

Matt

I can imagine a scenario when a program does an update, and there might
not be a real change - do you check in your program for that, for every
possibility? Yes, there are ways to simplify that, but it might not be
something you want to code.

So it may or may not be bad coding practice - it depends, IMO.

Cheers
Vern


On 6/11/2014 9:09 AM, Matt Olson wrote:

Why are you issuing an update on a database table when no updates have
occurred? That is terrible programming practice.

-----Original Message-----
From: Ricky Thompson [mailto:rickyt29@xxxxxxxxx]
Sent: Wednesday, June 11, 2014 8:11 AM
To: midrange-l@xxxxxxxxxxxx
Subject: DB2 Auto-update TimeStamp

I know you can add a timestamp to a table that automatically updates on
insert and update. But can you have it only update if there is a real
change in the data? For example if a update is done to the table but no
data changes I would like for it not to update the timestamp. My guess is
no it's not possible but thought I would ask.


myTimeStamp TIMESTAMP NOT NULL GENERATED BY DEFAULT FOR EACH ROW ON
UPDATE AS ROW CHANGE TIMESTAMP
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/midrange-l.



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.