dbo.arregla_datos_sociedades

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
--[obtener_bancos] '27249436769'
--[arregla_datos_sociedades]
CREATE OR ALTER PROCEDURE dbo.arregla_datos_sociedades

AS


BEGIN
    SET NOCOUNT ON;
declare @id_cliente int = 7777
declare @fecha_proceso date = convert(date,getdate())
declare @cuit_procesar varchar(20)

DECLARE ProdInfo CURSOR FOR

select cuit from screening_prov where cliente = 7777 and created > '2018-03-21' and cuit like '3%'
OPEN ProdInfo

FETCH NEXT FROM ProdInfo INTO @cuit_procesar

WHILE @@fetch_status = 0

BEGIN

  declare @razon_social varchar(500)
  declare @count_razon_social int
  set @count_razon_social =  ( select distinct count(nombre_persona) from padrones
  where identificacion =  @cuit_procesar and 
  nombre_persona in( select razon_social from sociedades_constituciones where (documento_soc is null or documento_soc = '' ) ))
 
  if(@count_razon_social = 1 )
  begin
 set @razon_social =  ( select distinct nombre_persona from padrones
  where identificacion =  @cuit_procesar and 
  nombre_persona in( select razon_social from sociedades_constituciones where (documento_soc is null or documento_soc = '' ) ))
  --select * from sociedades_constituciones where  razon_social  = 'ACEROS CORONA S.R.L.'
--select @razon_social,@cuit_procesar

 --select nombre_persona from padrones where identificacion = @cuit_procesar
 update sociedades_constituciones set documento_soc = @cuit_procesar,marcado = 1 where razon_social = @razon_social
  end
  
 
  -- select razon_social from sociedades_constituciones where documento_soc =  @cuit_procesar
 
    FETCH NEXT FROM ProdInfo INTO @cuit_procesar

END

CLOSE ProdInfo

DEALLOCATE ProdInfo 
END

GO

Used By

No items found