日期:2014-05-18 浏览次数:20398 次
DECLARE @spids VARCHAR(100) --SELECT a.spid,a.logiName,a.login_time FROM sysprocesses a SELECT @spids=ISNULL(@spids+',','') + RTRIM(a.spid) FROM sysprocesses a FULL JOIN sysprocesses b ON a.loginame=b.loginame WHERE b.spid=@@spid PRINT @spids --觉得哪个不爽,用 KILL spid将进程杀掉
------解决方案--------------------
DECLARE @spids VARCHAR(1000) SELECT @spids=ISNULL(@spids+'KILL ','KILL ') + RTRIM(a.spid)+';' FROM sysprocesses a FULL JOIN sysprocesses b ON a.loginame=b.loginame WHERE b.spid=@@spid AND a.spid!=@@spid --PRINT @spids EXEC(@spids)