Problem solve Get help with specific problems with your technologies, process and projects.

Procedure to kill Windows process in SQL Server 2005

Find out how to kill a Windows process in SQL Server 2005 in this expert response.

Xp_terminate_process is available to kill a Windows process in SQL Server 2000, but I couldn't find any extended procedure in Yukon? Is there any procedure?
Xp_terminate_process was not documented, and I'd like to remind readers that the number one rule of working with production SQL Server systems is to never rely on undocumented functionality! The reason for this is support. MS will not support you if something breaks because you used a part of the product that you weren't supposed to.

That said, the fix for this particular problem is quite easy, thanks to SQLCLR integration! The .NET Framework BCL contains a namespace called System.Diagnostics, which has a class called Process. The Process class exposes a method called Kill. I'll leave it as an exercise for the reader to roll this method into a SQLCLR routine that can be used to terminate a process -- just like the undocumented extended stored procedure.

Dig Deeper on Microsoft SQL Server 2005

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.