Tuesday, August 6, 2013

SQL SERVER – Find Currently Running Query – T-SQL

declare
    @spid int, 
    @sql_handle binary(20)

set @spid =64 -- Fill this  with spid

select  top 1
    @sql_handle = sql_handle

from    master.dbo.sysprocesses
where   spid = @spid
order by ecid

SELECT
   *
FROM ::fn_get_sql(@sql_handle)



If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website