transaction related error.

  • Hi All,

    Getting below error when running a stored proc? The stored proc was working fine for a while. However, not sure if there were any code changes.  Typically, when do we see this error ? How to troubleshoot this issue?

    As a Jr DBA, dont have clue about who wrote this code and I have limited coding experience. Dev team has reached out to us for help.

    EXEC   [dbo].[SP_xxxxxxxxx] @from_date = '2023-03-20 01:00:00', @to_date = '2023-03-20 03:30:00'

    /*

    error:

    The current transaction cannot be committed and cannot support operations that write to the log file.

    Roll back the transaction.

    */

    Regards,

    Sam

     

  • An error occurred in your logic.

    You would need to implement TRY/CATCH logic and in the catch block of the error, return the actual error details, using something like

    SELECT  
    ERROR_NUMBER() AS ErrorNumber
    ,ERROR_SEVERITY() AS ErrorSeverity
    ,ERROR_STATE() AS ErrorState
    ,ERROR_PROCEDURE() AS ErrorProcedure
    ,ERROR_LINE() AS ErrorLine
    ,ERROR_MESSAGE() AS ErrorMessage;

    https://learn.microsoft.com/en-us/sql/t-sql/language-elements/try-catch-transact-sql?view=sql-server-ver16

     

    This will give you more info to go on to the actual issue the procedure reported.

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

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