title: An error was raised during trigger execution.
body: <p>I cannot add screen shot here because of my reputation. Here is the error I got:</p>
  
  <p>Error Source: .NET SqlClient Data Provider
  Error Message: An Error was raised during trigger execution. The batch has been aborted and the user transaction, if any, has been rolled back.</p>
  
  <p>Here is my Stored Procedure.</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[uspLogError]
  AS
  BEGIN
      SET NOCOUNT ON;
  
  -- Output parameter value of 0 indicates that error 
  -- information was not logged.
  
      BEGIN TRY
      -- Return if there is no error information to log.
          IF ERROR_NUMBER() IS NULL
              RETURN;
  
      -- Return if inside an uncommittable transaction.
      -- Data insertion/modification is not allowed when 
      -- a transaction is in an uncommittable state.
          IF XACT_STATE() = -1
              BEGIN
                  PRINT 'Cannot log error since the current transaction is in an uncommittable state. '
                      + 'Rollback the transaction before executing uspLogError in order to successfully log error information.';
                  RETURN;
              END;
  
   DECLARE 
      @ErrorMessage    NVARCHAR(4000),
      @ErrorNumber     INT,
      @ErrorSeverity   INT,
      @ErrorState      INT,
      @ErrorLine       INT,
      @ErrorProcedure  NVARCHAR(200);
  
  -- Assign variables to error-handling functions that 
  -- capture information for RAISERROR.
  SELECT 
      @ErrorNumber = ERROR_NUMBER(),
      @ErrorSeverity = ERROR_SEVERITY(),
      @ErrorState = ERROR_STATE(),
      @ErrorLine = ERROR_LINE(),
      @ErrorProcedure = ISNULL(ERROR_PROCEDURE(), '-');
  
  -- Build the message string that will contain original
  -- error information.
  SELECT @ErrorMessage = 
      N'Error %d, Level %d, State %d, Procedure %s, Line %d, ' + 
          'Message: '+ ERROR_MESSAGE();
  
          INSERT  [dbo].[SQLErrorLog]
                  ( [UserName] ,
                    [ErrorTime] ,
                    [ErrorNumber] ,
                    [ErrorSeverity] ,
                    [ErrorState] ,
                    [ErrorProcedure] ,
                    [ErrorLine] ,
                    [ErrorMessage]
                  )
          VALUES  ( CONVERT(SYSNAME, CURRENT_USER) ,
                    GETDATE() ,
                    @ErrorNumber ,
                    @ErrorSeverity ,
                    @ErrorState ,
                    @ErrorProcedure ,
                    @ErrorLine ,
                    @ErrorMessage
                  );
  
  
      END TRY
      BEGIN CATCH
          PRINT 'An error occurred in stored procedure uspLogError: ';
          EXECUTE [dbo].[uspPrintError];
          RETURN -1;
      END CATCH
  
  -- Raise an error: msg_str parameter of RAISERROR will contain
  -- the original error information.
      RAISERROR 
      (
      @ErrorMessage, 
      @ErrorSeverity, 
      1,               
      @ErrorNumber,    -- parameter: original error number.
      @ErrorSeverity,  -- parameter: original error severity.
      @ErrorState,     -- parameter: original error state.
      @ErrorProcedure, -- parameter: original error procedure name.
      @ErrorLine       -- parameter: original error line number.
      );
  END; 
  </code></pre>