dbo.backend_obtener_cuits_no_encontrados_SC

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Samuel Gonzalez>
-- Create date: <11 Ago 2017>
-- Description: <Obtener Cuits no encontrados de Sociedades Constituciones para procesar por ABM>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.backend_obtener_cuits_no_encontrados_SC 
 -- Add the parameters for the stored procedure here

AS
BEGIN
 SET NOCOUNT ON;

    SELECT TOP 1000
        sc.id_fide                as id,
        sc.razon_social           as soc_nombre,
        sc.domicilio_sociedad     as soc_domicilio,
        sc.localidad_sociedad     as soc_localidad,
        sc.provincia_sociedad     as soc_provincia,
        sc.capita_social          as soc_capital_social,
        sc.nombre_integrante      as int_nombre,
        sc.cuit_int               as int_cuit_1,
        sc.cuit_integrante        as int_cuit_2,
        sc.tipodoc_int            as int_tipo_documento,
        sc.documento_integrante   as int_documento_1,
        sc.nrdoc_int              as int_documento_2,
        sc.domicilio_integrante   as int_domicilio,
        sc.localidad_integrante   as int_localidad,
        sc.provincia_integrante   as int_provincia_1,
        sc.provincia_int          as int_provincia_2,
        sc.nacionalidad_int       as int_nacionalidad,
        sc.cargo                  as int_cargo_1,
        sc.cargo_int              as int_cargo_2,
        sc.estado_civil_int       as int_estado_civil,
        sc.profesion_int          as int_profesion,
        sc.fecha_nacimiento_int   as int_fecha_nac,
        --convert(varchar(10),sc.fecha_nacimiento_int,103) as int_fecha_nac, 
  sc.titulo                 as pub_titulo,
        CAST(sc.objeto AS VARCHAR)as pub_objeto,
        sc.fuente                 as pub_fuente,
        sc.tipo_publicacion       as pub_tipo_1,
        sc.tipo_publicacion_2     as pub_tipo_2,
        sc.codigo_archivo         as pub_codigo,
        sc.nombre_file            as pub_archivo,
        sc.fecha_publicacion      as pub_fecha,
        --convert(varchar(10),sc.fecha_publicacion,103) as pub_fecha,
  sc.duracion               as pub_duracion,
        sc.contenido_archivo      as pub_contenido
    FROM sociedades_constituciones sc
    LEFT JOIN asignacion_cuits_sociedades_constituciones_log a
    ON (sc.id_fide = a.id_sociedades_constituciones)
    WHERE 
    -- SOCIEDADES QUE NO SE ENCONTRARON
    (
        ((sc.razon_social IS NOT NULL) AND (sc.razon_social != '')) 
  AND 
        ((sc.documento_soc IS NULL) OR (sc.documento_soc = ''))
        AND
        (a.id_sociedades_constituciones IS NULL)
    )
    OR -- INTEGRANTES QUE NO SE ENCONTRARON
    (
        ((sc.nombre_integrante IS NOT NULL) AND (sc.nombre_integrante != '')) 
  OR ((sc.documento_integrante IS NOT NULL) AND (sc.documento_integrante != '')) 
  OR ((sc.nrdoc_int IS NOT NULL) AND (sc.nrdoc_int != '')) 
  OR ((sc.cuit_int IS NOT NULL) AND (sc.cuit_int != ''))
  OR ((sc.cuit_integrante IS NOT NULL) AND (sc.cuit_integrante != ''))
        AND
        (a.id_sociedades_constituciones IS NULL)
    )
END

GO

Used By

No items found