I have this scenario:
SPID = 100 (A SSMS tab for example)
SELECT TOP 1 * FROM SOME_TABLE
GO
SELECT TOP 1 * FROM SOME_TABLE2
GO
SELECT TOP 1 * FROM SOME_TABLE3
When I run (DBCC INPUTBUFFER, sys.sysprocesses), I got only the last query executed:
SELECT TOP 1 * FROM SOME_TABLE3.
I need to get all queries from that session (in this case spid 100), not only the last. Is there a way to do this?
I'm searching for a way to do this using TSQL, get a trace sql-server Profiler is not a option.
Thanks!