SQL Server query dry run

后端 未结 2 538
遥遥无期
遥遥无期 2021-02-01 15:52

I run a lot of queries that perform INSERT\'s, insert SELECT\'s, UPDATE\'s and ALTER\'s on tables, and when developing these

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 16:02

    Begin the transaction, perform the table operations, and rollback as shown below:

    BEGIN TRAN
    
    UPDATE  C
    SET column1 = 'XXX'
    FROM table1 C
    
    SELECT *
    FROM table1
    WHERE column1 = 'XXX'
    
    ROLLBACK TRAN
    

    This will rollback all the operations performed since the last commit since the beginning of this transaction.

提交回复
热议问题