How to commit and rollback transaction in sql server?

前端 未结 3 778
自闭症患者
自闭症患者 2020-12-05 05:50

I have a huge script for creating tables and porting data from one server. So this sceipt basically has -

  1. Create statements for tables.
  2. Insert for po
3条回答
  •  执笔经年
    2020-12-05 06:14

    As per http://msdn.microsoft.com/en-us/library/ms188790.aspx

    @@ERROR: Returns the error number for the last Transact-SQL statement executed.

    You will have to check after each statement in order to perform the rollback and return.

    Commit can be at the end.

    HTH

提交回复
热议问题