dbo.procesar_cargo

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

6
Name Data Type Length Description
@cargo varchar 10
@cuit varchar 20
@desde varchar 7
@hasta varchar 7
@id_sc int 4
@ultimo char 1

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO

CREATE OR ALTER PROCEDURE dbo.procesar_cargo
-- Se debe ordenar parametros alfabeticamente ASC para facilitar el proceso de llamado del SP en PHP
@cargo varchar(10), 
@cuit  varchar(20),
@desde varchar(7),
@hasta varchar(7),
@id_sc int, 
@ultimo char(1)

AS

BEGIN
    SET NOCOUNT ON;
 declare @cuit_empresa varchar(20)
 declare @id_socio int
 if (@ultimo = '') begin set @ultimo = null end
 if (@desde  = '') begin set @desde  = null end
 if (@hasta  = '') begin set @hasta  = null end
    set @cuit_empresa = (select documento_soc from sociedades_constituciones where id_fide = @id_sc)
 if (@cuit_empresa is not null and @cuit_empresa != '')
    begin 
     INSERT INTO socios
     (c01_cuit_soc, c01_cuit, car_codigo, c04_ultimo, c04_periodo_desde, c04_periodo_hasta,visible,created)
      VALUES
        (@cuit, @cuit_empresa, @cargo, @ultimo, @desde, @hasta,'1',GETDATE())
     SET @id_socio = SCOPE_IDENTITY() -- Para verificar que se pudo ejecutar el insert
     SELECT @id_socio as id_socio
     end

END 

GO

Used By

No items found