473,473 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Applying CURRENT TIMESTAMP On Updates

rickbray66
7 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE `book_unit` (
  2.   `book_unit_id` varchar(32) NOT NULL default '',
  3.   `last_updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  4.  
The above statement in MySQL automatically sets the "last_updated" 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
Jun 25 '07 #1
1 5071
rickbray66
7 New Member
Still haven't found an easy way to achieve this without using a trigger, so that looks like the route I'm headed.

Just for reference:

A new clause: FOR EACH ROW ON UPDATE ROW CHANGE TIMESTAMP

has been implemented for DB2 9.1 for z/OS.

This is exactly what I'm looking for, but unfortunately, it does not appear to work for DB2 Express 9.1 for Windows.


Rick
Jun 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michael Hertz | last post by:
I am performing a XSLT stylesheet on a XML document and produce a new XML document. How can I insert in this new XML stylesheet a tag <currtime>..."the current date/time"....</currtime> where...
16
by: Brian Tkatch | last post by:
I have a PROCEDURE that test other PROCEDUREs. Timings_Call ------------------ Id Group Name Text Timings_Log
7
by: Damir | last post by:
I have a situation on a DB server where the "current timestamp" command shows the actual system time offset by one hour, which has never been noticed before?!? The DB2 is V9.1 (FP03), running on...
30
by: Ashit Vora | last post by:
Hi, I want to find the current time stamp in micro sec precision. The requirement is, my function is executed in an infinite loop. I measure a value and check if the value computed is what i...
1
by: Neel | last post by:
Hi, I want to find the current time stamp in micro sec precision. The requirement is, my function is executed in an infinite loop. I measure a value and check if the value computed is what i...
1
by: somadritadas23 | last post by:
I have a variable declaration inside a procedure which is not compiling in db2 9.5 :- DECLARE VSTARTTIME TIMESTAMP DEFAULT CURRENT TIMESTAMP; The procedure is a test procedure :- DROP...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.