Long query rollback - can I rename the table?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cheesey_toastie

    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!

    Steve

  • Dan Guzman

    #2
    Re: Long query rollback - can I rename the table?

    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?
    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_toasti e" <bletchley_scum @yahoo.co.ukwro te in message
    news:1173354816 .121044.292670@ h3g2000cwc.goog legroups.com...
    >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
    >

    Comment

    Working...