Re: enterprise manager and query analyzer

From: Arnel (arnelsin_at_hotmail.com)
Date: 08/22/03


Date: Fri, 22 Aug 2003 07:58:23 -0700


I am writing the code to check against sysprocesses and am running into
a
little trouble. Can you please point me in right direction?

My coding is weak and the error message i'm getting is a syntax error.
Can
I perform the following command in a cursor?
=======================================================
DECLARE @spid varchar(10)

DECLARE kill_spid CURSOR FOR
select spid from #spid

open kill_spid

fetch next from kill_spid
into @spid

while @@fetch_status = 0
begin
kill @spid =====getting syntax error on this line. how can I kill
spids from within this stored proc?========

fetch next from kill_spid
into @spid
end

close kill_spid
deallocate kill_spid

====================================================
Arnel Sinchongco

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: enterprise manager and query analyzer
    ... My coding is weak and the error message i'm getting is a syntax error. ... DECLARE @spid varchar ... fetch next from kill_spid ... how can I kill ...
    (microsoft.public.sqlserver.security)
  • RE: use of KILL
    ... > it is from @@SPID, but you may need to pass this to a second thread. ... KILL to a specific spid. ... The query might be eg ... The online books warns against killing processes with various commands ...
    (microsoft.public.sqlserver.programming)
  • Re: deadlock query
    ... When you kill spids blocked by orphaned processes, ... > Should I write an automated job to kill all spid that have '-2' in the Blk ... >> It seems you are referring to blocking, ...
    (microsoft.public.sqlserver.programming)
  • Kill 142,
    ... Kill 142, I was trying to kill one of the session and found the following ... SPID 142: transaction rollback in progress. ... Estimated rollback completion: ...
    (microsoft.public.sqlserver.clients)
  • Re: deadlock query
    ... Should I write an automated job to kill all spid that have '-2' in the Blk ... I am trying to make this process easier. ... > It seems you are referring to blocking, ...
    (microsoft.public.sqlserver.programming)

Loading