January 8, 2004 at 6:35 am
Is there any way, in a trigger, to access the name of the stored procedure that caused the trigger to fire? @@procid returns the trigger id, not the calling procedure. If a certain stored procedure causes the trigger to fire ( a monthly maintenance job) I want to exit the trigger without doing anything.
Terri
Terri
To speak algebraically, Mr. M. is execrable, but Mr. C. is
(x+1)-ecrable.
Edgar Allan Poe
[Discussing fellow writers Cornelius Mathews and William Ellery Channing.]
January 8, 2004 at 7:10 am
January 8, 2004 at 7:13 am
With the function app_name() you can know if the trigger is being called by a job.
the result is that is being called by SQL Agent and also is gives you the id of the job. If you can capture the id then you can know what job is it.
January 9, 2004 at 6:17 am
Thanks for the quick responses. The article by Andy Warren was particularly helpfull. I've decided to use the SET CONTENT_INFO solution for now.
Terri
Terri
To speak algebraically, Mr. M. is execrable, but Mr. C. is
(x+1)-ecrable.
Edgar Allan Poe
[Discussing fellow writers Cornelius Mathews and William Ellery Channing.]
January 9, 2004 at 5:46 pm
This works Beautifully:
DBCC INPUTBUFFER(@@spid)
It will return the sproc name or the query string (if uncompiled)
Signature is NULL
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply