paullie69
3/13/2007 4:10:00 PM
On 13 Mar, 15:22, paulli...@hotmail.com wrote:
> On 13 Mar, 14:30, "M Bourgon" <bour...@gmail.com> wrote:
>
>
>
>
>
> > On Mar 13, 8:14 am, paulli...@hotmail.com wrote:
>
> > > On 13 Mar, 10:22, "Uri Dimant" <u...@iscar.co.il> wrote:
>
> > > > Did you mean KILL command?
>
> > > > <paulli...@hotmail.com> wrote in message
>
> > > >news:1173780810.415648.8280@v33g2000cwv.googlegroups.com...
>
> > > > > Hi guru's
>
> > > > > SQL 2000 standard - is there a way of creating a script that will
> > > > > terminate all user processes to a specific database apart from 3 that
> > > > > must remain ?
>
> > > > > I can find scripts to terminate ALL processes but not specific ones
>
> > > > > Please let me know if you need any more information
>
> > > > > Thanks in advance for any help
>
> > > > > Regards
>
> > > > > Paul- Hide quoted text -
>
> > > > - Show quoted text -
>
> > > Hi
>
> > > Yes, the kill command but scripted to recursively parse through the
> > > database killing connections excluding 3 specific usernames which must
> > > remain intact,
>
> > > Cheers
>
> > > Paul
>
> > Something like this should do the trick, though let me add the
> > obligatory BE CAREFUL:
> > declare @spidlist table (id int identity(1,1), spid int)
> > declare @spidtokill
> > declare @start int
> > declare @end int
> > insert into @spidlist (spid) select spid from master.dbo.sysprocesses
> > where loginame is not null or loginame not in ('',
> > 'yoursqlservicesaccount', 'sa', 'your', 'three', 'names')
> > select @start = min(id) from @spidlist
> > select @end = max(id) from @spidlist
> > while @start <= @end
> > BEGIN
> > select @spidtokill = spid from @spidlist where id = @start
> > kill @spid --that may not work directly, in which case just turn it
> > into a variable and EXEC it
> > select @spidtokill = NULL --just in case
> > select @start = @start + 1
> > END- Hide quoted text -
>
> > - Show quoted text -
>
> thanks for the example, I'll give it a try
>
> Much appreciated
>
> Paul- Hide quoted text -
>
> - Show quoted text -
Hi all
Is there any way of making the above script database specific ? ie)
killing off connections from a particular db ?
Thanks once again
Paul