Sunday, March 25, 2012

connexion, processes ...

From the system table sysprocesses, how to do in order to extract
the SQL command related to the processes ?
What are system views/tables, scripts used to monitor and obtain more information
about processes, connexions... ?Straight from the Holy Book (SQL books Online)
----------------------
DECLARE @.Handle binary(20)
SELECT @.Handle = sql_handle FROM sysprocesses WHERE spid = 52
SELECT * FROM ::fn_get_sql(@.Handle)

----------------------|||Thanks for the reply, but the code is not working in my server (and mya be this is due to SP...). By the way, how to find the last SP applied to sql server ?

DBCC INPUTBUFFER(80)
EventType Parameters EventInfo
--- ---- ---------
RPC Event 0 DVSPAYS_CODELIB_DVSPRINC_S;1

DECLARE @.Handle binary(20)
SELECT @.Handle = sql_handle FROM sysprocesses WHERE spid = 80
SELECT * FROM ::fn_get_sql(@.Handle)
dbid objectid number encrypted text
-- ---- -- --- ----------------------------------------------------------------------------
No row(s)sqlsql

No comments:

Post a Comment