Skip to content

Instantly share code, notes, and snippets.

@Greyeye
Created June 3, 2014 22:29
Show Gist options
  • Save Greyeye/9cfe29ff7a10f67d2b62 to your computer and use it in GitHub Desktop.
Save Greyeye/9cfe29ff7a10f67d2b62 to your computer and use it in GitHub Desktop.
declare @kill varchar(8000) = '';
select @kill=@kill+'kill '+convert(varchar(5),spid)+';'
from master..sysprocesses
where dbid=db_id('MyDB');
print @kill;
exec (@kill);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment