|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Current ProcessHi
I've been told that I can use the following SQL expressions to find out the current SQL being executed under a certain SPID, but for some reason I cannot get this to work. Is there something wrong, in what I have written? --************************************* DECLARE @Handle binary(20) SELECT @Handle = sql_handle FROM master.dbo.sysprocesses WHERE spid = 55 SELECT * FROM ::fn_get_sql(@Handle) --************************************* Kind Regards Ricky (WIN2K/SQL2K-SP4) It should work if the specified SPId is still running.
Try this DECLARE @Handle binary(20) SELECT @Handle = sql_handle FROM master.dbo.sysprocesses WHERE spid = @@SPID SELECT * FROM ::fn_get_sql(@Handle) Show quote "ricky" <ri***@ricky.com> wrote in message news:O08GR61mGHA.4212@TK2MSFTNGP04.phx.gbl... > Hi > > I've been told that I can use the following SQL expressions to find out > the > current SQL being executed under a certain SPID, but for some reason I > cannot get this to work. > > Is there something wrong, in what I have written? > > --************************************* > DECLARE @Handle binary(20) > SELECT @Handle = sql_handle FROM master.dbo.sysprocesses WHERE spid = 55 > SELECT * FROM ::fn_get_sql(@Handle) > --************************************* > > Kind Regards > > Ricky > (WIN2K/SQL2K-SP4) > > |
|||||||||||||||||||||||