Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
26| Name | Data Type | Length | Description |
|---|---|---|---|
| @codigo_ent | varchar | 5 | |
| @fec_inf | varchar | 6 | |
| @tipo | varchar | 2 | |
| @iden | varchar | 11 | |
| @actividad | varchar | 3 | |
| @situacion | varchar | 2 | |
| @prestamos | numeric | 9 | |
| @particip | numeric | 9 | |
| @garotor | numeric | 9 | |
| @o_cptos | numeric | 9 | |
| @garprefa | numeric | 9 | |
| @garprefb | numeric | 9 | |
| @singarpref | numeric | 9 | |
| @cgarprefa | numeric | 9 | |
| @cgarprefb | numeric | 9 | |
| @sincgarpre | numeric | 9 | |
| @previ | numeric | 9 | |
| @deuda_cubr | numeric | 5 | |
| @proc_jud | numeric | 5 | |
| @refinanc | numeric | 5 | |
| @rec_oblig | numeric | 5 | |
| @sit_juridi | numeric | 5 | |
| @irre_dispt | numeric | 5 | |
| @dia_atraso | numeric | 5 | |
| @vigente | bit | 1 | |
| @dbf_filename | varchar | 15 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec cendeu_mongo_batch
'00007',
'202408',
'11',
'30500003193',
'000641',
'1',
'708540.0',
'.0',
'.0',
'.0',
'231010.0',
'.0',
'477530.0',
'.0',
'.0',
'.0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
1,
'cendeu_202408'
*/
-- =============================================
-- Author: <Leonel Turchetto>
-- Modified by: <Alejandro Burgol>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.cendeu_mongo_batch
-- Add the parameters for the stored procedure here
@codigo_ent varchar(5),
@fec_inf varchar(6),
@tipo varchar(2),
@iden varchar(11),
@actividad varchar(3),
@situacion varchar(2),
@prestamos numeric(12, 1),
@particip numeric(12, 1),
@garotor numeric(12, 1),
@o_cptos numeric(12, 1),
@garprefa numeric(12, 1),
@garprefb numeric(12, 1),
@singarpref numeric(12, 1),
@cgarprefa numeric(12, 1),
@cgarprefb numeric(12, 1),
@sincgarpre numeric(12, 1),
@previ numeric(12, 1),
@deuda_cubr numeric(1, 0),
@proc_jud numeric(1, 0),
@refinanc numeric(1, 0),
@rec_oblig numeric(1, 0),
@sit_juridi numeric(1, 0),
@irre_dispt numeric(1, 0),
@dia_atraso numeric(4, 0),
@vigente bit,
@dbf_filename varchar(15)
AS
BEGIN
SET NOCOUNT ON;
declare @existe int=null
declare @resultado int=0
/*
select * from cendeu where iden = '30550255339' and codigo_ent='00299' order by created desc
select * from cendeu where iden = '30550255339' order by created desc
*/
select @existe = isnull(max(id_cendeu),0) from cendeu
where codigo_ent = @codigo_ent
and fec_inf = @fec_inf
and tipo = @tipo
and iden = @iden
and situacion = @situacion
and prestamos = @prestamos
and vigente = 1
/* si el registro NO existe entonces lo insertamos y
respondemos 1 para que se pueda borrar del Mongo siempre y cuando no falle el insert */
if( @existe = 0)
BEGIN
set @resultado = 1
-- begin TRY
insert into cendeu
(codigo_ent,fec_inf,tipo,iden,actividad,situacion,prestamos,particip,garotor,o_cptos,garprefa,garprefb,singarpref,cgarprefa,cgarprefb,sincgarpre,previ,deuda_cubr,proc_jud,refinanc,rec_oblig,sit_juridi,irre_dispt,dia_atraso,vigente,created,dbf_filename,id_persona)
values
(@codigo_ent,@fec_inf,@tipo,@iden,@actividad,@situacion,@prestamos,@particip,@garotor,@o_cptos,@garprefa,@garprefb,@singarpref,@cgarprefa,@cgarprefb,@sincgarpre,@previ,@deuda_cubr,@proc_jud,@refinanc,@rec_oblig,@sit_juridi,@irre_dispt,@dia_atraso,@vigente,getdate(),@dbf_filename,0)
-- end TRY
-- begin CATCH
/* Falla del insert enviamos un 0 para no borrar del Mongo */
--set @resultado = 0
--end CATCH
END
/* si el registro YA existe entonces NO lo insertamos y
respondemos 1 para que se pueda borrar del Mongo siempre */
if( @existe > 0)
begin
set @resultado = 1
end
select @resultado as resultado
/*
(select isnull(max(id_cendeu),0) from cendeu_temp
where codigo_ent = @codigo_ent
and fec_inf = @fec_inf
and tipo = @tipo
and iden = @iden
and situacion = @situacion
and prestamos = @prestamos
and vigente = 1)
*/
END
GO
GO
/*
exec cendeu_mongo_batch
'00007',
'202408',
'11',
'30500003193',
'000641',
'1',
'708540.0',
'.0',
'.0',
'.0',
'231010.0',
'.0',
'477530.0',
'.0',
'.0',
'.0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
'0',
1,
'cendeu_202408'
*/
-- =============================================
-- Author: <Leonel Turchetto>
-- Modified by: <Alejandro Burgol>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.cendeu_mongo_batch
-- Add the parameters for the stored procedure here
@codigo_ent varchar(5),
@fec_inf varchar(6),
@tipo varchar(2),
@iden varchar(11),
@actividad varchar(3),
@situacion varchar(2),
@prestamos numeric(12, 1),
@particip numeric(12, 1),
@garotor numeric(12, 1),
@o_cptos numeric(12, 1),
@garprefa numeric(12, 1),
@garprefb numeric(12, 1),
@singarpref numeric(12, 1),
@cgarprefa numeric(12, 1),
@cgarprefb numeric(12, 1),
@sincgarpre numeric(12, 1),
@previ numeric(12, 1),
@deuda_cubr numeric(1, 0),
@proc_jud numeric(1, 0),
@refinanc numeric(1, 0),
@rec_oblig numeric(1, 0),
@sit_juridi numeric(1, 0),
@irre_dispt numeric(1, 0),
@dia_atraso numeric(4, 0),
@vigente bit,
@dbf_filename varchar(15)
AS
BEGIN
SET NOCOUNT ON;
declare @existe int=null
declare @resultado int=0
/*
select * from cendeu where iden = '30550255339' and codigo_ent='00299' order by created desc
select * from cendeu where iden = '30550255339' order by created desc
*/
select @existe = isnull(max(id_cendeu),0) from cendeu
where codigo_ent = @codigo_ent
and fec_inf = @fec_inf
and tipo = @tipo
and iden = @iden
and situacion = @situacion
and prestamos = @prestamos
and vigente = 1
/* si el registro NO existe entonces lo insertamos y
respondemos 1 para que se pueda borrar del Mongo siempre y cuando no falle el insert */
if( @existe = 0)
BEGIN
set @resultado = 1
-- begin TRY
insert into cendeu
(codigo_ent,fec_inf,tipo,iden,actividad,situacion,prestamos,particip,garotor,o_cptos,garprefa,garprefb,singarpref,cgarprefa,cgarprefb,sincgarpre,previ,deuda_cubr,proc_jud,refinanc,rec_oblig,sit_juridi,irre_dispt,dia_atraso,vigente,created,dbf_filename,id_persona)
values
(@codigo_ent,@fec_inf,@tipo,@iden,@actividad,@situacion,@prestamos,@particip,@garotor,@o_cptos,@garprefa,@garprefb,@singarpref,@cgarprefa,@cgarprefb,@sincgarpre,@previ,@deuda_cubr,@proc_jud,@refinanc,@rec_oblig,@sit_juridi,@irre_dispt,@dia_atraso,@vigente,getdate(),@dbf_filename,0)
-- end TRY
-- begin CATCH
/* Falla del insert enviamos un 0 para no borrar del Mongo */
--set @resultado = 0
--end CATCH
END
/* si el registro YA existe entonces NO lo insertamos y
respondemos 1 para que se pueda borrar del Mongo siempre */
if( @existe > 0)
begin
set @resultado = 1
end
select @resultado as resultado
/*
(select isnull(max(id_cendeu),0) from cendeu_temp
where codigo_ent = @codigo_ent
and fec_inf = @fec_inf
and tipo = @tipo
and iden = @iden
and situacion = @situacion
and prestamos = @prestamos
and vigente = 1)
*/
END
GO
Depends On
1Used By
No items found