sessions

  • 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 ?

  • dbcc inputbffer(spid)

    ----------
    Ashish

  • 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.

  • 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