If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > system create/update date

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-19-07, 22:38
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
system create/update date

i have a table which has system create date and system update date......
so my table definition is

create table Mytable
(
id integer not null,
content char(100),
create_date date ,
update_date date
)

is it possible that whenever i create an id the create date and update date get sets automatically to current date and when i update the same id contents only the update date gets updated to current date.....

i know this can be done using trigggers.....but is it possible that this can be done using the create table definition only...
Reply With Quote
  #2 (permalink)  
Old 06-19-07, 23:48
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
No, because updates only take place on the columns you specify. I don't what the problem is in creating a trigger.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 06-20-07, 01:23
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
well i have around 20 tables requiring the same criteria so i was curious to check whether this could be done without triggers since then I'll have to create 20 triggers for each of the tables in the database.....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On