I have a trigger which updates a value in another before an insert/update/delete occurs.
What I want to do is find the value of a specific column in the row that was just added, and use that value in my insert or update.
How can this be done?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should create additional table and log all changes. Inside triggers you can access old, new values by using
NEW,OLDprefixes. Put them all (if you need all values which had been changed) into the log table.Logging can be different. You can create table with the same structure with new columns {log_id, log_dtm}. Or if you need to log only certain fields you can create log table: {log_id, table, field, value, log_dtm} (or something like this).
Off course, to do it you should change your triggers to add new functionality.