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
 How to stop the server processing our request.

Author  Topic 

arutla
Starting Member

4 Posts

Posted - 2008-07-23 : 02:45:49
Hi,
Once we execute the delete command, server starts deleting from data base. How to stop the server deleting.(Will it takes response from us at this time)

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-23 : 04:16:31
you can stop execution of query in query analyser by clicking red button on top
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-23 : 04:23:35
But you have to wait until the server completes the rollback of the transaction, which can take a long time.
It doesn't return immediately.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

arutla
Starting Member

4 Posts

Posted - 2008-07-23 : 07:15:41
Ok thanks for the answer. In visual studio .NET 2003 web application i had written the code inside a buttton control(Name:deletefiles). When i click this button it starts deleting specified records. In the process the button name should get change to "cancel"(If Database contains so many file, it takes some time). Now if we press that "cancel" (button, it should cancel deleting the records at that instance(suppose it had deleted 6 records, it should stop at this instance). Thanks in advance.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-23 : 07:34:24
quote:
Originally posted by arutla

Ok thanks for the answer. In visual studio .NET 2003 web application i had written the code inside a buttton control(Name:deletefiles). When i click this button it starts deleting specified records. In the process the button name should get change to "cancel"(If Database contains so many file, it takes some time). Now if we press that "cancel" (button, it should cancel deleting the records at that instance(suppose it had deleted 6 records, it should stop at this instance). Thanks in advance.


but in that case even if you click cancel, it will rollback the transaction so that delete wont occur.
Go to Top of Page

arutla
Starting Member

4 Posts

Posted - 2008-07-23 : 07:39:10
If suppose if we keep delete query in a loop. THen it will delete some records or not?? How it will rollback the transaction. Can you tell me the procedure. What logic we should write to cancel the server task.
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-07-24 : 14:43:35
Put delete in transaction, check books online for details and samples.
Go to Top of Page
   

- Advertisement -