In haste, I stupidly ran a statement to update a table without qualifying it with a where statement. So it started to update all records in the table.
I immediately noticed the error and hit the 'Cancel Execution" button in SQL Server Management Studio, but it took a minute to stop running.
So my question is, did it roll back the changes or were they made until it was told to stop?
I can't tell which records were updated just by looking at them. I'd have to restore the table if it did make any changes.
Thanks.
I wanted to run:
Update tableA
set newdate = '2019-01-01'
where account = 'abc'
but instead I ran:
Update tableA
set newdate = '2019-01-01'
The database is a transactional type database.
SQL Server has the default transaction behaviour by default. That means that each sentence you run in the query editor is like:
BEGIN TRANSACTION
<YOUR COMMAND>
COMMIT TRANSACTION
So, if you have cancelled before finished, the transaction should be rolled back.
If the query hasn't finished before being cancelled then yes, it was rolled back. Either whole update was executed or nothing was changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With