TSQL: Try-Catch Transaction in Trigger

后端 未结 9 1708
长发绾君心
长发绾君心 2020-12-05 08:09

I am trying to put a try-catch statement inside a trigger using Microsoft Server 2005.

BEGIN TRANSACTION
BEGIN TRY
    --Some More SQL
    COMMIT TRANSACTION         


        
9条回答
  •  盖世英雄少女心
    2020-12-05 08:42

    u07ch,

    Unfortunately you cannot use save transaction and try.. catch together - they simply cannot work together:

    http://sqlblog.com/blogs/alexander_kuznetsov/archive/2008/11/15/avoid-mixing-old-and-new-styles-of-error-handling.aspx

提交回复
热议问题