Thanks a lot Roger! That really helped.
"Roger Wolter[MSFT]" wrote:
> Depending on what software you use to connect to the database, there should
> be a cancel command method or function:
>
>
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.cancel.aspx >
> This may or may not work depending on what the database is doing, it may not
> be listening for commands from the client.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
>
http://www.microsoft.com/info/cpyright.htm >
> "Alexander Korol" <AlexanderKorol@discussions.microsoft.com> wrote in
> message news:DA1D009C-DC57-4E70-9318-8B2E507E8778@microsoft.com...
> > Hello!
> >
> > I am using SQL Server 2005. VB.NET framework2
> >
> > I have to execute long running code in SQL Server. The execution is
> > started
> > in a separate thread in my application. What I need - is to stop execution
> > whenever a certain event occures and start calling same long running
> > procedure with other parameters. The problem is I can not just let first
> > procedure work till its end. The operations it does require lot of CPU
> > time.
> > So I really need to interrup the previous execution first. I tried to kill
> > the thread in my application calling Thread.Abort - it really does what is
> > needed - execution of procedure stops. CPU becomes low. In VB code I close
> > connection. But if I look Activity monitor - There is Process that has
> > status
> > runnable and some locks. And there are as many such processes as many
> > there
> > were threads killed. So the connection does not seem to be closed or ...?
> >
> > Any ideas of how to solve my problem or at least how to leave the process
> > in
> > Status 'sleeping' are greately appreciated.
> >
> > Thanks.
>
>