|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SP:StmtCompleted eventHow to get stored procedure's name in which statement was executed?
Alexey Rokhin wrote:
> How to get stored procedure's name in which statement was executed? Stored procedure statements are captured using the SP:StmtStarting/Completed events. Individual statement statistics are in that event as well. Stored procedure start/stop is in the SP:Starting/Completed events, but there are no perf stats in those events. You need to use either SQL:StmtCompleted or RPC:Completed to get the stats for the entire procedure. -- David Gugick Quest Software Hi Alexey
Capture the DatabaseID and ObjectID data along with SP:StmtCompleted and after you have that info, SELECT db_name( <databaseID>) will show you the db. USE that db and then SELECT object_name (<ObjectID>) to get the stored procedure name. Show quote "Alexey Rokhin" <a*@hotmail.com> wrote in message news:%232jvvSs6FHA.1188@TK2MSFTNGP12.phx.gbl... > How to get stored procedure's name in which statement was executed? > > Kalen Delaney wrote:
> Hi Alexey Just to add what Kalen wrote: If you query a trace file or trace table and > > Capture the DatabaseID and ObjectID data along with SP:StmtCompleted > and after you have that info, > > SELECT db_name( <databaseID>) will show you the db. USE that db and > then SELECT object_name (<ObjectID>) to get the stored procedure name. > > > "Alexey Rokhin" <a*@hotmail.com> wrote in message > news:%232jvvSs6FHA.1188@TK2MSFTNGP12.phx.gbl... >> How to get stored procedure's name in which statement was executed? use the object_name() function, you need to be aware that the function is database-centric. That is, if you capture data from more than one database in the trace, you must be in the context of the database of the object name you are trying to resolve. Otherwise, you'll either get a null result or the name of an incorrect object. -- David Gugick Quest Software SP:StmtCompleted usually includes the sp name as a comment in the TextData.
-- Show quoteAndrew J. Kelly SQL MVP "Alexey Rokhin" <a*@hotmail.com> wrote in message news:%232jvvSs6FHA.1188@TK2MSFTNGP12.phx.gbl... > How to get stored procedure's name in which statement was executed? > I forget to point I mean Profiler 2005.
Show quote "Andrew J. Kelly" <sqlmvpnooospam@shadhawk.com> wrote in message news:ufSjFZz6FHA.2384@TK2MSFTNGP12.phx.gbl... > SP:StmtCompleted usually includes the sp name as a comment in the > TextData. > > > -- > Andrew J. Kelly SQL MVP > > > > "Alexey Rokhin" <a*@hotmail.com> wrote in message > news:%232jvvSs6FHA.1188@TK2MSFTNGP12.phx.gbl... >> How to get stored procedure's name in which statement was executed? >> > > |
|||||||||||||||||||||||