1341Re: Drop all Database Connections

Thursday, November 12, 2009

Thanks

On Nov 11, 2:16 pm, Vino Raphael <vinoraph...@gmail.com> wrote:
> Drop all Database Connections
>
> Use Master
> Go
> Declare @dbname sysname
> Set @dbname = 'name of database you want to drop connections from'
> Declare @spid int
> Select @spid = min(spid) from master.dbo.sysprocesses
> where dbid = db_id(@dbname)
> While @spid Is Not Null
> Begin
> Execute ('Kill ' + @spid)
> Select @spid = min(spid) from master.dbo.sysprocesses
> where dbid = db_id(@dbname) and spid > @spid
> End
>
> Vinohttp://asp-sql.blogspot.com

Dot Net, VB.NET, C#, ADO.Net, ASP.NET, XML, WML, Ajax, SAP, Ruby, Java, SAP, WAP, WML, PHP, MYSQL, ASP, SQL, HTML, DHTML CSS, Flash, Flex, IT Jobs , Freelancer Projects & many more

Read more.. http://groups.google.com/group/it_help_desk

0 comments

Post a Comment