|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Call Stack in SQL ServerIs it possible to get the call stack from within a SQL statement?
Specifically, I'd like to get the statement that causes a trigger to fire from within the trigger itself. Thanks, -k DBCC STACKDUMP
But it will give you the stack from every thread, not just your own. The stacks are printed to the errorlog. Make sure your symbols are matched. <kelly.harri***@gmail.com> wrote in message Show quote news:1155252246.626327.78200@75g2000cwc.googlegroups.com... > Is it possible to get the call stack from within a SQL statement? > Specifically, I'd like to get the statement that causes a trigger to > fire from within the trigger itself. > > Thanks, > > -k > Kelly,
DBCC INPUTBUFFER will display the last statement sent from the client, for the given SPID. In order to do anything useful with it, you have to capture the returned information into a table - something like this: create table #inp_buff (EventType nvarchar(30), Parameters Int, EventInfo nvarchar(255)) insert #inp_buff exec('DBCC INPUTBUFFER(@@spid) WITH NO_INFOMSGS') select eventinfo from #inp_buff HTH, Dean <kelly.harri***@gmail.com> wrote in message Show quote news:1155252246.626327.78200@75g2000cwc.googlegroups.com... > Is it possible to get the call stack from within a SQL statement? > Specifically, I'd like to get the statement that causes a trigger to > fire from within the trigger itself. > > Thanks, > > -k > |
|||||||||||||||||||||||