Created
September 15, 2015 22:34
-
-
Save jorgedison/69f25f3f8382ed639a58 to your computer and use it in GitHub Desktop.
View Process Database SQL Server
This file contains 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
USE [master] | |
GO | |
-- Select a SYS.processes con bloqueo mayor a valor 0 | |
SELECT * FROM SYS.sysprocesses WHERE blocked > 0; | |
-- Select a SYS.processes con login distinto a sa | |
SELECT * FROM SYS.sysprocesses WHERE loginame NOT IN ('sa'); | |
-- Ubicamos el PID y ejecutamos la consulta | |
DECLARE @HANDLE BINARY(20) | |
SELECT @HANDLE = SQL_HANDLE FROM SYSPROCESSES WHERE SPID = 95 | |
SELECT * FROM ::FN_GET_SQL(@HANDLE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment