Hi,
In Yukon, is it possible to capture the entire DML statement with the parameter values that triggered the DML trigger inside the trigger body?
Basically trying to see the equivalent as the eventdata() in a DDL trigger, that provides the CommandText()
Rgds
No. This is not possible.|||Thanks for the quick reply UJ.Was just trying to create a detailed Audit trace. (DDL, DML, App Login & Logout)
Can a CLR Trigger extract such data from the SQL Profiler - say using SMO in Yukon etc. - i'm not sure.
Though this would make it a very heavy trigger, but then we can run it async.
Rgds|||SMO cannot be used within CLR trigger right now. It is not supported. Also, using profiler to do these type of actions from trigger code is not ideal. Triggers should usually be very light weight and efficient. The more complex logic that you put inside your trigger the harder it is in terms of performance, development and management. Also, I am not sure how useful it will be to know which statement actually caused the trigger to fire. Note that this might not be very straight-forward too. For example, the update trigger might be fired by UPDATE statement from different SPs or triggers even. In this case, it might be useful to know the SP call that fired the trigger indirectly. What you are asking for is a call / stack trace which is not available in T-SQL now.|||Thanks UJ.
Shall keep you posted on this.
Can we expect SMO in triggers/ Call stack in Yukon?
No comments:
Post a Comment