Wednesday, March 28, 2012

Long query rollback - can I rename the table?

I have a long query which I have set off and would like to stop, and
rename one of the tables used.

My query is due to my lack of understanding of the underlying
structure of MSSQL-Server...

So say and update updates TABLE_A and I stop it, whilst this
transaction is rolling back I attempt to rename TABLE_A to TABLE_A_OLD
and rename a different table to become TABLE_A. I am assuming that
the rollback actions will use the object reference of TABLE_A_OLD and
continue to rollback the effects on the correct table and not corrupt
'new' TABLE_A... or will it not allow me to rename TABLE_A until the
rollback is complete?

Thanks for any help!

SteveSo say and update updates TABLE_A and I stop it, whilst this

Quote:

Originally Posted by

transaction is rolling back I attempt to rename TABLE_A to TABLE_A_OLD
and rename a different table to become TABLE_A. I am assuming that
the rollback actions will use the object reference of TABLE_A_OLD and
continue to rollback the effects on the correct table and not corrupt
'new' TABLE_A... or will it not allow me to rename TABLE_A until the
rollback is complete?


I would expect that the rename will be blocked until the rollback completes.
The rename requires a schema modification lock, which is incompatible with
the locks held on TABLE_A by the open transaction.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"cheesey_toastie" <bletchley_scum@.yahoo.co.ukwrote in message
news:1173354816.121044.292670@.h3g2000cwc.googlegro ups.com...

Quote:

Originally Posted by

>I have a long query which I have set off and would like to stop, and
rename one of the tables used.
>
My query is due to my lack of understanding of the underlying
structure of MSSQL-Server...
>
So say and update updates TABLE_A and I stop it, whilst this
transaction is rolling back I attempt to rename TABLE_A to TABLE_A_OLD
and rename a different table to become TABLE_A. I am assuming that
the rollback actions will use the object reference of TABLE_A_OLD and
continue to rollback the effects on the correct table and not corrupt
'new' TABLE_A... or will it not allow me to rename TABLE_A until the
rollback is complete?
>
Thanks for any help!
>
Steve
>

No comments:

Post a Comment