Home All Groups Group Topic Archive Search About
Author
29 Jun 2006 9:29 AM
ricky
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)

Author
29 Jun 2006 10:04 AM
Roji. P. Thomas
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)

--
Regards
Roji. P. Thomas
http://toponewithties.blogspot.com
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)
>
>

AddThis Social Bookmark Button