Get the current process for table update (stored proc/query) and log to audit column using trigger

  • Hello Guys,

    I was trying to see if it's possible to get the current process for a table update(stored proc/query) and log to an audit column using an update trigger. How is it possible.

    (QUOTENAME(OBJECT_SCHEMA_NAME(@@PROCID))+'.'+QUOTENAME(OBJECT_NAME(@@PROCID)) - only gives the update trigger name

    If any one can provide the script for the trigger, that would be great.

    Many thanks!

  • SQL!$@w$0ME (1/22/2016)


    Hello Guys,

    I was trying to see if it's possible to get the current process for a table update(stored proc/query) and log to an audit column using an update trigger. How is it possible.

    (QUOTENAME(OBJECT_SCHEMA_NAME(@@PROCID))+'.'+QUOTENAME(OBJECT_NAME(@@PROCID)) - only gives the update trigger name

    If any one can provide the script for the trigger, that would be great.

    Many thanks!

    You mean the name of the proc whose insert/update caused the trigger to fire, right? I don't think that you can do this directly.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Yes Phil. Any other way to implement this.

  • You could try something like this.

    Not very elegant, to say the least.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply