select DB_NAME(dbid), ('kill ' + convert(nvarchar(10), spid) ) as kill_statement, *
from sys.sysprocesses where DB_NAME(dbid) = 'DBNAME'
--or:
DECLARE @SQL nvarchar(max)
SELECT @SQL=COALESCE(@SQL,'') +'Kill '+CAST(spid AS nvarchar(10))+ '; '
FROM sys.sysprocesses WHERE DB_NAME(dbid) = 'DBNAME'
--or:
DECLARE @SQL nvarchar(max)
SELECT @SQL=COALESCE(@SQL,'') +'Kill '+CAST(spid AS nvarchar(10))+ '; '
FROM sys.sysprocesses WHERE DB_NAME(dbid) = 'DBNAME'
No comments:
Post a Comment