Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

We are auditing a table TRANSACTIONS that inserts a row in HISTORY_TRANSACTIONS when specific columns are changed. These inserts happen through a number of triggers defined on TRANSACTIONS table. Is it possible to find out which trigger inserted a specific record in HISTORY_TRANSACTIONS ? (seems impossible, but I wanted to confirm that no system tables could achieve this as well?)

share|improve this question

1 Answer 1

You are correct in your assumption – there is nothing done at the database level that would track the source of a row. You would need to modify your history table definition and trigger logic to add this kind of tracking.

share|improve this answer
    
That being said...I think there is some audit logging you can turn on in DB2 but I do not know to what extent it logs. I believe that by default this is off. –  Chris Aldrich Feb 15 '13 at 21:42
    
Auditing (at least on DB2 for LUW) would be able to track the actual insert statement, but because triggers are compiled in to the actual insert statement it would not be possible to identify which trigger caused the particular action. –  Ian Bjorhovde Feb 19 '13 at 6:27
    
that's a bummer.... –  Chris Aldrich Feb 19 '13 at 14:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.