This is a discussion on Struck with Updation within the MySQL forums, part of the Database category; I have a table designed named as employee. In that various columns and one of the attributes in these employee ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have a table designed named as employee. In that various columns and one of the attributes in these employee table is up_date. I am struck with a task namely I want to have this up_date files getting updated with current date as soon as a user updates the table. The column must get updated automatically without any intervention by users. How can I achieve this? Kindly help me out.
|
|
|||
|
You can use the triggering concept that will help you to fire the trigger and update the column up_date only when the user updates the table. I have given below the skeleton format of trigger you can make use to finish your process.
CREATE TRIGGER triggername ON databasename.tablename FOR UPDATE AS update tablename set up_date=getdate() from tablename inner join sample on sample.PKCol = tablename.PKCol In the above the table name for you is employee. The getdate() will help to get the current date inserted into the column up_date on the employee table. |
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Struck with Formatting | Adrian | C and C++ | 0 | 06-08-2007 04:15 PM |
| Struck with this Task | Rahulbatra | C and C++ | 1 | 05-28-2007 03:12 AM |
| Struck Abstract with Abstract Class | priyaraji | C and C++ | 2 | 05-01-2007 10:04 AM |