@@ -19,31 +19,37 @@ PRINT 'show the blocked processes. '
1919PRINT ' ====================================================================='
2020GO
2121
22- SELECT DB_NAME (dbid ) as ' Database Name' , * FROM master .dbo .sysprocesses WITH (NOLOCK )
23- WHERE BLOCKED <> 0
22+ SELECT
23+ [Database Name] = DB_NAME ([dbid])
24+ , *
25+ FROM [master].[dbo].[sysprocesses] WITH (NOLOCK )
26+ WHERE [BLOCKED] != 0 ;
2427-- DB_NAME(dbid) = 'PMDB_TEST' -- change the database name here
2528
2629PRINT ' ====================================================================='
2730PRINT ' show the blocked process record. '
2831PRINT ' ====================================================================='
2932GO
3033
31- SELECT DB_NAME (dbid ) AS ' Database Name' , * FROM master .dbo .sysprocesses
34+ SELECT
35+ [Database Name] = DB_NAME ([dbid])
36+ , *
37+ FROM [master].[dbo].[sysprocesses];
3238WHERE SPID = 212 -- update the spid here
3339
3440PRINT ' ====================================================================='
3541PRINT ' get the sql statement of the blocked process for the ticket. '
3642PRINT ' ====================================================================='
3743GO
3844
39- DBCC INPUTBUFFER(212 ) -- update the spid here
45+ DBCC INPUTBUFFER(212 ); -- update the spid here
4046
4147PRINT ' ====================================================================='
4248PRINT ' remove the blocked process. '
4349PRINT ' ====================================================================='
4450GO
4551
46- -- KILL 212
52+ -- KILL 212;
4753
4854PRINT ' ====================================================================='
4955PRINT ' Finished!'
0 commit comments