• Hari.Sharma (10/6/2009)


    ramonaraujop (10/5/2009)


    to do rollback in a right way,

    I wrote:

    -----------------

    BEGIN Tran t1

    DROP TABLE T

    go

    ROLLBACK

    GO

    ----------------

    SELECT * FROM T

    the Question of the Day was wrong, I guess, so, was completed with errors.

    The transaction was used before cross the word "go" so,

    I dont know why you are putting GO in between a transaction. As far as my understanding is concern, a transaction can't be splitted in two batches as you are doing by using GO.

    Now come to the second point where you mentioned it a wrong question, but the question is all about DDL Rollback... Since it is mentioned in BOL that DDL statements cannot be rolled back then why the Table exists?

    The following is directly from the referenced link in the answer to this question:

    Many types of operations are recorded in the transaction log, including:

    The start and end of each transaction.

    Every data modification (insert, update, or delete). This includes changes to system tables made by system stored procedures or data definition language (DDL) statements.

    Every extent allocation or deallocation.

    The creation or dropping of a table or index.