With Version 9 we got the ability to define a timestamp column that will automatically updated when some other column on the row is updated (kind of like a trigger).
REC_UPDT_TS TIMESTAMP NOT NULL
GENERATED BY DEFAULT
FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP
However, there may be circumstances in which we don't want to have this column automatically updated. In those cases, you can code the SQL as follows;
UPDATE CREATOR.TABLE
SET column1 = 'some value'
, REC_UPDT_TS = REC_UPDT_TS
WHERE column2 = 'another value'
Tales of a DB2 DBA
Monday, September 26, 2011
Greetings!
My name is Lynne. I've been a DB2 DBA on and off for over 24 years. I've worked with many aspects of DB2 in a few Fortune 500 shops and several smaller ones (but I've never worked with data sharing, surprisingly enough!). Anyways, I thought it would be fun, interesting (helpful?) to post various tips and techniques I've used. So hopefully, you will find some of them helpful. I will also link to great DB2 resources.
Please enjoy your visit and ask me questions on anything that I post...
Please enjoy your visit and ask me questions on anything that I post...
Subscribe to:
Posts (Atom)