The transaction ended in the trigger. The batch has been aborted ...

  • Hi everybody,

    I keep getting this error :

    Msg 3609, Level 16, State 1, Line 1

    The transaction ended in the trigger. The batch has been aborted.

    in a SP that generates some pretty simple dynamic UPDATES and run them one by one in a cursor by using sp_executesql, like this:

    WHILE @@fetch_status = 0

    BEGIN

    PRINT 'Executing: '+@sql

    EXEC sp_executesql @sql

    PRINT @SQL + ' EXECUTED ...'

    FETCH next FROM ic INTO @sql

    END

    What is weird about that:

    I added a PRINT ... as a last line in the trigger and that PRINT is being executed;

    I tried to run the same UPDATE queries (as a batch) in SSMS and they're working there ...

    It is mindblowing, the queries are very simple, (and sintactically corect, because they run without crashing in SSMS), and I get the same error even for test cases where no data should be actually updated ...

    PS @sql is nvarchar(1000) and the UPDATE queries are really short and simple...

    Please help ...

    So the last 3 lines in my "Messages" tab are like this:

    tablename_here_onUpdate code in trigger has been executed - black - that's the last line (PRINT) in trigger

    Msg 3609, Level 16, State 1, Line 1 - RED

    The transaction ended in the trigger. The batch has been aborted. - RED

  • I have to answer it - just a RAISERROR with a lower severity ....

    :w00t: :w00t:

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply