Sqlsever Kill locked process
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON GO -- ============================================= -- Author: <machao> -- Create date: <2014-04-16> -- Description: <kill all lock in db> -- ============================================= CREATE PROCEDURE [dbo].UP_Lock_Kill AS BEGIN DECLARE @sql VARCHAR(100) WHILE 1 = 1 BEGIN SELECT TOP 1 @sql = ‘kill ‘ + CAST(spid AS VARCHAR(3)) FROM master..sysprocesses WHERE spid > 50 AND spid <> @@spid IF @@rowcount = 0 BREAK EXEC(@sql) END END GO
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。