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
 General SQL Server Forums
 New to SQL Server Programming
 Kill SSQL stored procedure invoked through Unix

Author  Topic 

Rahul Raj
Starting Member

41 Posts

Posted - 2014-11-11 : 23:29:21
hi,

I am using sql server 2008 version and invoking the stored procedure using unix script. I want to know the procedure of killing the stored procedure in sql server.

If I kill -9 the unix script will it also terminate the process at the SQL server. When I executed the kill -9 PID in unix and ran the command exec sp_who2 it showed me only one sessionid and status as runnable - which means waiting for resources. BUt I am not sure whether it was the one which was triggered through unix.

My SP is executing in loop thereby is there any way I can avoid going into infinite loop?

Thanks in advance!

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-12 : 09:08:58
Post your stored procedure. Let's see if it is looping as you surmise.
Go to Top of Page

Rahul Raj
Starting Member

41 Posts

Posted - 2014-11-12 : 23:58:55
Hi grreturn,
Thanks for the reply!

I have done mistake in the while loop.

But still I would like to know how to kill the process in case of looping.

Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-11-13 : 08:36:12
Use sp_who or sp_who2 to get your session id, then KILL the session:

http://msdn.microsoft.com/en-us/library/ms173730.aspx

Note that you need ALTER ANY CONNECTION permission to do that.
Go to Top of Page
   

- Advertisement -