dbo.carga_email_afip

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

3
Name Data Type Length Description
@p_id_padron int 4
@p_email varchar 100
@p_tipo varchar 50

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.carga_email_afip

@p_id_padron int,
@p_email varchar(100),
@p_tipo varchar(50)

AS
BEGIN
 IF ((select count(*) from emails where 
        (id_padron = @p_id_padron) 
        and ((email is null and @p_email is null) or (email = @p_email))) = 0 )
 begin
        begin try
      insert into emails 
                (id_padron, email, tipo, created) values 
                (@p_id_padron, @p_email, @p_tipo, GETDATE())
            select 'ok' as ok
        end try
        begin catch
            select ERROR_MESSAGE() as error
        end catch
 end
END

GO

Depends On

1

Used By

No items found