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 > MySQL > date and time stamp a changed row

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-04, 15:40
lothario lothario is offline
Registered User
 
Join Date: Jan 2004
Posts: 6
date and time stamp a changed row

Hi,

I am about to declare a table with 20 columns.

How do I create 4 more columns:
1. current Time
2. current Day of the month
3. current Month
4. current Year

Such that:
a. These 4 columns are not editable by the user.
b. Whenever a row is updated/inserted/replace/etc. then
these 4 columns in that row are automatically updated
by the system accordingly.

Thanks.
Reply With Quote
  #2 (permalink)  
Old 05-14-04, 15:59
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
I don't think that MySQL can do that yet.

-PatP
Reply With Quote
  #3 (permalink)  
Old 05-14-04, 21:24
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
a. what do you mean by "not editable by the user"? which user?

b. combine all 4 into 1 timestamp column, and make it the first one in the table, and the system will automatically update it just as you want -- and when you want the pieces (time, day, month, year) just use the appropriate functions
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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