Created
February 15, 2018 23:31
-
-
Save cbertolasio/632c5f3e0272afe7560203ef741a17b8 to your computer and use it in GitHub Desktop.
gets the last sql command issued by a spid
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sp_who2 | |
DECLARE @sqltext VARBINARY(128) | |
SELECT @sqltext = sql_handle | |
FROM sys.sysprocesses | |
WHERE spid = 62 | |
SELECT TEXT | |
FROM sys.dm_exec_sql_text(@sqltext) | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment