Solved

Kill a Thread Id in Sql

Posted on 2002-05-02
1
1,757 Views
Last Modified: 2007-12-19
I have a vb application who call one StoreProcedure. This SP update the db with some information, this sp take about 15min. to finish it's work and one person can call it 2-3 times in 5 minutes.They can be more then 1 person who call this sp at same time. People can stop and restart a thread of this SP.

For ex. I have 2 people connected

Spid 1 & Spid 2

Spid 1 have 2 thread (kpid 11 & Kpid 12)
Spid 2 have 3 thread (kpid 21, 22, 23)

If Spid 1 want to kill only Kpid 12, how can i do that. For now, i'm only able to kill Spid 1 but this will kill all Kpid for this user.

0
Comment
Question by:JokerTanant
1 Comment
 
LVL 2

Accepted Solution

by:
ykchakri earned 150 total points
ID: 6987205
It is not possible to kill a specific kpid using 'kill' command (or any command for that matter). And it is not advisable to do so. SQL server will divide long running transactions into multiple threads and process them parallelly and joins all threads at the end of the transaction.

If you kill one of these threads, it leaves your transaction in an inconsistent state.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
t-sql Joining Issue 10 40
SQL Server Designer 19 42
create an aggregate function 9 36
syntax sql error 2 13
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question