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
/*
EXEC [IGJ_AsignaCuit]
*/
CREATE OR ALTER PROCEDURE dbo.IGJ_AsignaCuit
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ERRORNUMBER int
DECLARE @nombre_todos varchar(300),@limpio varchar(300)
DECLARE @razon_social varchar(300),@ID int
DECLARE @identi varchar(20)
DECLARE @numero_correlativo VARCHAR(50)
begin
DECLARE IGJDatos Cursor
FOR
/*
select *,nombre_todos, replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(nombre_todos)),'SRL',''))),'S.A.I.C.F.A.R.I.M.I. Y E.',''))),'COOP LTDA',''))),'S A',''))),'S.A.',''))),'SOCIEDAD ANONIMA',''))),' ','* NEAR *') AS limpio from pedidos_enriquecimiento where cuit like '3%'
*/
/*
SELECT top 10 razon_social,max(id) as ID
from igj_asambleas
group by razon_social
*/
/*
select top 10 replace(ltrim(rtrim(razon_social)),' ','* NEAR *') as razon_social,max(id) as ID from igj_asambleas where identificacion is null
group by razon_social
*/
/*select top 100 replace(ltrim(rtrim(razon_social)),' ','* NEAR *') as razon_social,ID,* from igj_asambleas where identificacion is null*/
select top 28000 '"' + ltrim(rtrim(replace(razon_social,'"',''))) + '"' as razon_social,ID,numero_correlativo from igj_asambleas where isnull(procesado,0) = 0
Open IGJDatos
Fetch NEXT FROM IGJDatos INTO @razon_social,@ID,@numero_correlativo
While (@@FETCH_STATUS = 0)
BEGIN
/* update igj_asambleas set identificacion = padrones.identificacion
from padrones
WHERE CONTAINS((nombre_persona),@razon_social) and habilitado = 1
and igj_asambleas.id= @ID
*/
set @identi = null
select top 1 @identi= identificacion from padrones
WHERE CONTAINS((nombre_persona),@razon_social) and habilitado = 1
if @identi is not null
begin
update igj_asambleas set identificacion = @identi,procesado = 1
where igj_asambleas.id= @ID
/*
update igj_asambleas set identificacion = @identi,procesado = 1
where igj_asambleas.numero_correlativo= @numero_correlativo
*/
end
if @identi is null
begin
update igj_asambleas set identificacion = null,procesado = 1
where igj_asambleas.id= @ID
/*
update igj_asambleas set identificacion = null,procesado = 1
where igj_asambleas.numero_correlativo= @numero_correlativo
*/
end
/*
update padrones set nombre_persona = REPLACE(nombre_persona,'SUCESION DE ','')
where id_padron=@ID
*/
Fetch NEXT FROM IGJDatos INTO @razon_social,@ID,@numero_correlativo
END
CLOSE IGJDatos
DEALLOCATE IGJDatos
end
END
GO
GO
/*
EXEC [IGJ_AsignaCuit]
*/
CREATE OR ALTER PROCEDURE dbo.IGJ_AsignaCuit
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ERRORNUMBER int
DECLARE @nombre_todos varchar(300),@limpio varchar(300)
DECLARE @razon_social varchar(300),@ID int
DECLARE @identi varchar(20)
DECLARE @numero_correlativo VARCHAR(50)
begin
DECLARE IGJDatos Cursor
FOR
/*
select *,nombre_todos, replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(replace(ltrim(rtrim(nombre_todos)),'SRL',''))),'S.A.I.C.F.A.R.I.M.I. Y E.',''))),'COOP LTDA',''))),'S A',''))),'S.A.',''))),'SOCIEDAD ANONIMA',''))),' ','* NEAR *') AS limpio from pedidos_enriquecimiento where cuit like '3%'
*/
/*
SELECT top 10 razon_social,max(id) as ID
from igj_asambleas
group by razon_social
*/
/*
select top 10 replace(ltrim(rtrim(razon_social)),' ','* NEAR *') as razon_social,max(id) as ID from igj_asambleas where identificacion is null
group by razon_social
*/
/*select top 100 replace(ltrim(rtrim(razon_social)),' ','* NEAR *') as razon_social,ID,* from igj_asambleas where identificacion is null*/
select top 28000 '"' + ltrim(rtrim(replace(razon_social,'"',''))) + '"' as razon_social,ID,numero_correlativo from igj_asambleas where isnull(procesado,0) = 0
Open IGJDatos
Fetch NEXT FROM IGJDatos INTO @razon_social,@ID,@numero_correlativo
While (@@FETCH_STATUS = 0)
BEGIN
/* update igj_asambleas set identificacion = padrones.identificacion
from padrones
WHERE CONTAINS((nombre_persona),@razon_social) and habilitado = 1
and igj_asambleas.id= @ID
*/
set @identi = null
select top 1 @identi= identificacion from padrones
WHERE CONTAINS((nombre_persona),@razon_social) and habilitado = 1
if @identi is not null
begin
update igj_asambleas set identificacion = @identi,procesado = 1
where igj_asambleas.id= @ID
/*
update igj_asambleas set identificacion = @identi,procesado = 1
where igj_asambleas.numero_correlativo= @numero_correlativo
*/
end
if @identi is null
begin
update igj_asambleas set identificacion = null,procesado = 1
where igj_asambleas.id= @ID
/*
update igj_asambleas set identificacion = null,procesado = 1
where igj_asambleas.numero_correlativo= @numero_correlativo
*/
end
/*
update padrones set nombre_persona = REPLACE(nombre_persona,'SUCESION DE ','')
where id_padron=@ID
*/
Fetch NEXT FROM IGJDatos INTO @razon_social,@ID,@numero_correlativo
END
CLOSE IGJDatos
DEALLOCATE IGJDatos
end
END
GO
Depends On
2Used By
No items found