|
Oh like this
USE Master
SET NOCOUNT ON
Declare @spID varchar(100)
Declare @SQL varchar(5000)
Select @spID=``,@SQL=''
Create table #tmp (spid int,ecid int,status varchar(50),loginame varchar(50),hostname varchar(100),blk int,dbname varchar(50),cmd varchar(400))
Insert into #tmp
Exec sp_who
Select @SQL=@SQL+' Kill'+Cast(spid as varchar) From #tmp where dbname='Northwind'
exec (@SQL)
Drop table #tmp |
|