column update without using trigger
-
22-09-2019 - |
Question
SCENARIO:
I have two tables, table1(col1 date) and table2(col2 varchar(20)).
REQUIREMENT:
Whenever anyone updated the value in col2, todays date should be inserted/updated in col1. It should be done without using triggers.
Now, I cannot think of anything possible to do it. So, I need your help; PLEASE.
Thank you.
Solution
It can't be done automatically without using triggers. You need to manually run a statement for updating table1. Running both update table2 and update table1 statements inside a transaction you can ensure the integrity of your data.
OTHER TIPS
Call a stored procedure to save the data, and it can update the date.
If you don't mind a delay, you could schedule a regular job to poll table2 for changes and update table1. There are performance considerations, but just sayin' - it's possible to do it without triggers; you have to just worry about inconsistent data (a problem which can be mitigated).