But there's a problem.
i can get the STATEMENT only for SPIDs that r currently running. Not for those which have status SLEEPING.
DBCC INPUTBUFFER returns the last statment for SLEEPING connections but ::fn_get_sql doesn't.
eg. if i open QA , execute STATEMENT and don't disconnect, i can get the text from DBCCINPUTBUFFER but not from the function.