Retrieve SessionID and batch information
You may be aware using SP_WHO or SP_WHO2 statements you can get information about a session id and statement that is running since good olden days of SQL Server.
Within SQL 2005 version you can take help of TSQL:
SELECT session_id, text
FROM
sys.dm_exec_requests s1
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS s2
Similarly you can look at syscacheobjects system table which is turned into DMV sys.dm_exec_cached_plans that will let you see the individual statements with the literals in the query text in your execution plan cache. Still there is lot you need to understand on simple and forced parameterization plans within the cache. For more information on the query text and the plans of the cached queries refer to this blogPost.
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.