I'm looking to only insert unique values within a record on update with a trigger. Right now I have two tables set up with a trigger on insert/update. When a user updates a field within the Employee's table, it copies all of the information from the current record into the Employee History table. However, my users want to be able to see what fields were modified within the Employee History table. The trigger currently just copies all fields (and values in those fields - most are text) from the current Employee's table to the Employee History table. The user then can compare the current record in the employee's table with the employee history records and manually scroll through to find what values in each field are different, but this takes quite a bit of time.
I would like the trigger to look at all the current values in the fields it is going to copy, if the values have not been changed (or are equal to the current values in the Employee History table), then do not update/insert those fields in the employee history table; otherwise update only the fields that have been changed. This would ideally show only updated field values for each history record, instead of duplicating all of the field values.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
888Washington
I'm looking to only insert unique values within a record on update with a trigger. Right now I have two tables set up with a trigger on insert/update. When a user updates a field within the Employee's table, it copies all of the information from the current record into the Employee History table. However, my users want to be able to see what fields were modified within the Employee History table. The trigger currently just copies all fields (and values in those fields - most are text) from the current Employee's table to the Employee History table. The user then can compare the current record in the employee's table with the employee history records and manually scroll through to find what values in each field are different, but this takes quite a bit of time.
I would like the trigger to look at all the current values in the fields it is going to copy, if the values have not been changed (or are equal to the current values in the Employee History table), then do not update/insert those fields in the employee history table; otherwise update only the fields that have been changed. This would ideally show only updated field values for each history record, instead of duplicating all of the field values.
Thank you for any assistance!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.