Skip to content

Instantly share code, notes, and snippets.

@andyj
Created October 13, 2015 08:54
Show Gist options
  • Save andyj/d0a4eabf51e83f678c40 to your computer and use it in GitHub Desktop.
Save andyj/d0a4eabf51e83f678c40 to your computer and use it in GitHub Desktop.
Transaction (Process ID) was deadlocked on lock - find and kill process
CREATE TABLE #Result
(
spid int,
ecid int,
status varchar(max),
loginname varchar(max),
hostname varchar(max),
blk varchar(max),
dbname varchar(max),
cmd varchar(max),
request_id int
)
INSERT #Result EXEC sp_who
SELECT * FROM #Result WHERE dbname LIKE '%XXX%'
DROP TABLE #Result
-- Once you know the SPID you can run
KILL 28 -- or whatever the SPID is
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment