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.
| Author |
Topic |
|
Job
Yak Posting Veteran
69 Posts |
Posted - 2005-11-30 : 17:11:57
|
| I assume if I start an update query then stop it, sql undoes whatever updates it made, this is why it often takes a long time. Is there a way to actually STOP? If it is an update that I don't mind if it rolls back the transaction can I force it to stop immediately? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-11-30 : 18:00:10
|
| A rollback is required if the transaction is terminated/killed. There is no way to leave it partially committed. If even you turned off the database server to force a stop, SQL Server would decide to roll it back at startup if the transaction didn't complete. Rolling forward and backwards of transactions is performed by SQL Server at startup to ensure that we have a consistent database.Tara Kizeraka tduggan |
 |
|
|
Job
Yak Posting Veteran
69 Posts |
Posted - 2005-11-30 : 19:23:40
|
| Ok. That makes sense. Thanks for the info. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-12-01 : 00:45:40
|
| If you've got a massive update to do you could do it in batches - so that you can interrupt itSET ROWCOUNT 1000UPDATE USET MyColumn = 'FOO'FROM MyTable AS UWHERE MyColumn = 'BAR'SET ROWCOUNT 0 -- Reset the limit!!put this in a loop (checking the @@ROWCOUNT until it is zero) if you want it to run until completion, if you abort it the rows already processed will be kept (take care that it isn't in a transaction block such that the whole lot gets rolled back!)Kristen |
 |
|
|
|
|
|