-- ==================================================================================
-- Author:		<Ernesto Serfilippi>
-- Create date: <27.02.2019>
-- Description:	<Inserimento riga di Insert_ExcludedList>
-- ==================================================================================
CREATE PROCEDURE [C6MartPeriodicoImmobiliare].[Insert_ExcludedList]
  @IDReport int,
  @Rete varchar(1),
  @CodiceFiscale varchar(16),
  @DescrizioneErrore varchar(500),
  @DataInserimento datetime,
  @Bloccato bit,
  @DataRiferimento varchar(8),
  @Return int OUTPUT
/*
SP Parameter Comment 
*/
WITH EXEC AS CALLER 
AS
/*
SP Body Comment
*/
	BEGIN TRANSACTION
    BEGIN TRY
    INSERT INTO [C6MartPeriodicoImmobiliare].[ExcludedList](
      [IDReport],
      [Rete],
      [CodiceFiscale],
      [DescrizioneErrore],
      [DataInserimento],
      [Bloccato],
      [DataRiferimento])
      VALUES (
      @IDReport,
      @Rete,
      @CodiceFiscale,
      @DescrizioneErrore,
      @DataInserimento,
      @Bloccato,
      @DataRiferimento)
      Set @Return=@IDReport;
    END TRY
	BEGIN CATCH
      IF ERROR_NUMBER()=2601 
      BEGIN
        Set @Return=-2601;
      END
       IF @@TRANCOUNT > 0
        ROLLBACK TRANSACTION;
     END CATCH
    IF @@TRANCOUNT > 0
      COMMIT TRANSACTION;