DECLARE @d VARCHAR(8000) 
SET @d = ' ' 

SELECT 
    @d = @d + '   kill   ' + CAST(spid AS VARCHAR) + CHAR(13)
FROM   
    MASTER.sys.sysprocesses
WHERE  
    dbid = DB_ID('DBName')

EXEC (@d)

( 本文版权属于© 2015 卓逸天成 | 转载请注明作者和出处:卓逸知识文库 http://kb.skight.com )