declare @s varchar(1000)select @s=isnull(@s,'')+' Kill ' +rtrim(spID) from master..sysprocesses where dbid=db_id('test')select @s