DB2 Express for Windows: DB2 v9.1.200.166
Hello. I've recently started working with DB2. I'm in the process of migrating a DDL from MySQL over to DB2. Consider the following snipet:
The above statement in MySQL automatically sets the "last_updat ed" field to the current timestamp upon updates if the data is not supplied in the SQL statement. Is there an easy way to achieve this in DB2 without using a trigger? I've looked at "GENERATED BY DEFAULT" and "FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP" documentation without much luck.
Any help is greatly appreciated.
Thanks!!
Rick
Hello. I've recently started working with DB2. I'm in the process of migrating a DDL from MySQL over to DB2. Consider the following snipet:
Code:
CREATE TABLE `book_unit` ( `book_unit_id` varchar(32) NOT NULL default '', `last_updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
Any help is greatly appreciated.
Thanks!!
Rick
Comment