Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Kill command

Author  Topic 

carumuga
Posting Yak Master

174 Posts

Posted - 2009-10-30 : 02:36:13
I schedule to run the following commands from the job and encountered an error "Process ID 114 is not an active Process ID". On checking the sysprocesses or sp_who, there is no such process id seems to be listed in the table. Please let me know the root cause of such failures.

set concat_null_yields_null off
declare @cmd varchar(2000)
select @cmd=@cmd+';kill '+cast(p.spid as varchar(5))
from master..sysprocesses p, master..sysdatabases d
where p.dbid=d.dbid
and d.name in ('tempdb','master', 'other databases')

set @cmd=substring(@cmd,2,len(@cmd))+';'
exec (@cmd)

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-10-30 : 05:28:37
By the time you issued the kill, process 114 was no longer active. It is an error because you are trying to kill something that isn't there.
Go to Top of Page

carumuga
Posting Yak Master

174 Posts

Posted - 2009-10-30 : 10:18:01
But anyway the killing process shouldn't be failed and its the first time facing such error.

E.g EXEC (Kill 124; Kill 114; Kill 137)

Any suggestion guys...
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2009-10-30 : 10:22:08
are you trying to have the script kill all database connections across the whole server
Go to Top of Page

carumuga
Posting Yak Master

174 Posts

Posted - 2009-11-01 : 22:42:29
trying to kill connections few of the databases in the server, not all.
Go to Top of Page
   

- Advertisement -