title: Return after insert stored procedure, if success is return 1 else return 0
body: <p>I have a stored procedure. After insert, it should return a value: if the insert was successful, then return 1, else return 0. </p>
  
  <p>For example:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[sp_save_transaction]
      -- Parameter
      @SourceCode nvarchar(255),
      @DepositorName nvarchar(255),
      @TransactionDate date
  AS
      SET XACT_ABORT ON  
  
      --BEGIN TRAN
      DECLARE @PaymentDate date
      DECLARE @PaymentDepositorName nvarchar(255)
      DECLARE @PaymentNationId int
  
      SET @PaymentDate = @TransactionDate
      SET @PaymentDepositorName = @DepositorName
      SET @PaymentNationId = (SELECT [NAT_SYS_ID] 
                              FROM [MB_TB_NATION] 
                              WHERE [NAT_CODE] = @DepositorCountry)
  
      INSERT INTO [dbo].[MB_TB_TRANSACTION]
             ([TRA_PAYMENT_DATE], [TRA_PAYMENT_DEPOSITOR_NAME], [TRA_PAYMENT_NATION_ID])
      VALUES (@PaymentDate, @PaymentDepositorName, @PaymentNationId, )
  </code></pre>
  
  <p>Thank you for your help!</p>