w0051977
w0051977

Reputation: 15817

Does DELETE complete after stopping the query

Say I execute a statement like this:

DELETE FROM Person WHERE PersonNo in (
select PersonNo from Person
left join SportsPerson on Person.PersonNo=SportsPerson.PersonNo
)

This will delete all persons not linked to a sport. Say it took two hours to run (because the database is not indexed) and I decided to stop the process in SQL Studio Manager (perhaps because of locks on the table causing access issues with the application), then does the process complete? I ran a test and it appears that is does.

I know I should wrap the statement in a transaction. I am just curious about this.

Upvotes: 0

Views: 44

Answers (1)

koushik veldanda
koushik veldanda

Reputation: 1107

It will stop the query and releases lock unless you used hold lock

and you can ROLLBACK if you want or can COMMIT it..

Upvotes: 1

Related Questions