|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Trigger IDHi All,
I am faced with a situation where i want to know the ID or name of a trigger that fires another trigger. For example say i have two tables namely tblSource and tblDestination. Now i have say one trigger(called trg_updateDest) for updating the tblDestination and assume that this trigger sits on the source table. There is another trigger (called trg_updateX) for updating some table called X and assume that this trigger sits on the destination table. Now i want to know which trigger has fired the second trigger called "trg_updateX". regards, Joy A Trigger won't be 'firing' another Trigger.
An INSERT, UPDATE, or DELETE statement will cause a Trigger to 'fire'. Are you attempting to locate the associated INSERT, UPDATE, or DELETE statements? -- Arnie Rowland, Ph.D. Westwood Consulting, Inc Most good judgment comes from experience. Most experience comes from bad judgment. - Anonymous Show quote "Joy" <J**@discussions.microsoft.com> wrote in message news:D0AF3FF1-CB98-4455-9CF5-2C7E16051D4F@microsoft.com... > Hi All, > I am faced with a situation where i want to know the ID or name of a > trigger > that fires another trigger. For example say i have two tables namely > tblSource and tblDestination. Now i have say one trigger(called > trg_updateDest) for updating the tblDestination and assume that this > trigger > sits on the source table. > There is another trigger (called trg_updateX) for updating some table > called > X and assume that this trigger sits on the destination table. > > Now i want to know which trigger has fired the second trigger called > "trg_updateX". > > regards, > Joy Hi Arnie,
Can you please elaborate on what do you mean to say by "A Trigger won't be 'firing' another Trigger". To answer your question about whether or not i am trying to locate the associated INSERT,UPDATE or DELETE statement, i would say NO because i do know how to retrieve it (if required). regards, Joy Show quote "Arnie Rowland" wrote: > A Trigger won't be 'firing' another Trigger. > > An INSERT, UPDATE, or DELETE statement will cause a Trigger to 'fire'. > > Are you attempting to locate the associated INSERT, UPDATE, or DELETE > statements? > > -- > Arnie Rowland, Ph.D. > Westwood Consulting, Inc > > Most good judgment comes from experience. > Most experience comes from bad judgment. > - Anonymous > > > "Joy" <J**@discussions.microsoft.com> wrote in message > news:D0AF3FF1-CB98-4455-9CF5-2C7E16051D4F@microsoft.com... > > Hi All, > > I am faced with a situation where i want to know the ID or name of a > > trigger > > that fires another trigger. For example say i have two tables namely > > tblSource and tblDestination. Now i have say one trigger(called > > trg_updateDest) for updating the tblDestination and assume that this > > trigger > > sits on the source table. > > There is another trigger (called trg_updateX) for updating some table > > called > > X and assume that this trigger sits on the destination table. > > > > Now i want to know which trigger has fired the second trigger called > > "trg_updateX". > > > > regards, > > Joy > > > Joy wrote:
> Hi Arnie, What Arnie is saying is that triggers don't call each other. Given > Can you please elaborate on what do you mean to say by "A Trigger won't be > 'firing' another Trigger". > three tables, TableA, TableB, and TableC, TriggerA on TableA inserts a record into TableB. TriggerB on TableB inserts a record into TableC. The flow looks like this: INSERT INTO TableA | +- TriggerA fires on INSERT | +- INSERT INTO TableB | +- TriggerB fires on INSERT | +- INSERT INTO TableCYour original question sounded as if you were thinking: INSERT INTO TableA | +- TriggerA fires on INSERT | +- TriggerA fires TriggerBHi Tracy,
I must say you have got me absolutely right. Now considering the example that you have given, can you tell me how do i get to know the ID or the level of the trigger that initiated the first insert for example in you case Trigger A. regards, Joy Show quote "Tracy McKibben" wrote: > Joy wrote: > > Hi Arnie, > > Can you please elaborate on what do you mean to say by "A Trigger won't be > > 'firing' another Trigger". > > > > What Arnie is saying is that triggers don't call each other. Given > three tables, TableA, TableB, and TableC, TriggerA on TableA inserts a > record into TableB. TriggerB on TableB inserts a record into TableC. > The flow looks like this: > > INSERT INTO TableA > | > +- TriggerA fires on INSERT > | > +- INSERT INTO TableB > | > +- TriggerB fires on INSERT > | > +- INSERT INTO TableC > > Your original question sounded as if you were thinking: > > INSERT INTO TableA > | > +- TriggerA fires on INSERT > | > +- TriggerA fires TriggerB > > > > -- > Tracy McKibben > MCDBA > http://www.realsqlguy.com > Joy wrote:
> Hi Tracy, I'm not sure that's possible. There is @@NESTLEVEL that will tell you > I must say you have got me absolutely right. Now considering the example > that you have given, can you tell me how do i get to know the ID or the level > of the trigger that initiated the first insert for example in you case > Trigger A. > how many levels deep you are, but to my knowledge there's nothing that will let you walk back up the calling tree to see what process started it. |
|||||||||||||||||||||||