April 10, 2003 at 9:46 am
I want to write an update trigger on a table that inserts into a debug table whenever a particular field in my table gets updated by the many different sprocs I use to do updates. How can I capture the name of the sproc that has updated the field in the table and insert that name into my debug table using the trigger?
April 10, 2003 at 10:07 am
R, can you reference the @@PROCID global variable in the INSERT statement within the trigger?
INSERT INTO <logtable>
(
<stuff>,
SprocName,
<morestuff>
)
VALUES (
<stuff>,
OBJECT_NAME(@@PROCID),
<morestuff>
)
SJTerrill
P.S. I'm wondering if there's another, perhaps more easily managed, method to perform this trick. Perhaps a stored proc that gets called from within your stored procs that perform these tasks... and pass that proc the current OBJECT_NAME(@@PROCID) value. I'd be interested in what the resident gurus think!
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply