September 16, 2010 at 4:26 am
is it posssible to find text of the query from a sessions id always or would be there be any situations where i cant find text ?
September 16, 2010 at 4:35 am
dbcc inputbffer(spid)
----------
Ashish
September 16, 2010 at 5:00 am
yes i understand there is DBCC INPUTBUFFER(spid) and fn_get_sql but both has some limitations like 256 char for imput buffer and fn_get_sql will not return if it is not exist in the cache.
September 16, 2010 at 5:06 am
try this :-
DECLARE @sqltext VARBINARY(128)
SELECT @sqltext = sql_handle
FROM sys.sysprocesses
WHERE spid = 'your spid'
SELECT TEXT
FROM sys.dm_exec_sql_text(@sqltext)
GO
the length you can modify further
----------
Ashish
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply