Archive

Archive for September 17, 2010

Stopping a DELETE statement in middle of its execution – MSDN TSQL forum

September 17, 2010 Leave a comment

 
–> Question:

I accidentally executed the DELETE statement for a table.

However, I stopped it before it completed.

What effect will this have on the table in Database, is my data safe?
 

–> My Answer:

In SQL Server by default a single SQL statement is bounded within a Transaction.

So, if you cancelled the DELETE statement execution in between it would have cancelled the overall deletion from the table. So either all of your rows are safe or all gone. SQL Server ensures that a transaction should be completed fully or not at all, one of the ACID properties.