Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
1| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_cuit | varchar | 20 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
--exec [obtener_edictos_prueba] 20250070498
--exec [obtener_edictos] 20250070498
CREATE OR ALTER PROCEDURE dbo.obtener_edictos_prueba
@p_cuit varchar(20)
AS
BEGIN
SET NOCOUNT ON;
/*
select distinct edictos.provincia_boletin,convert(varchar(10),cast(fecha_boletin as date),103) as fechab,fecha_boletin,texto
from edictos where (cuit_sociedad = @p_cuit or cuit_integrante = @p_cuit)
union
select distinct
provincia_boletin = IIF(provincias.prv_nombre is null, sociedades_constituciones.provincia_sociedad, provincias.prv_nombre),
convert(varchar(11),fecha_publicacion,103) as fechab,fecha_publicacion, cast(contenido_archivo as varchar(max)) AS texto
from sociedades_constituciones
left join provincias on provincias.prv_codigo = provincia_boletin and pai_codigo_ifx = 54
where (documento_soc = @p_cuit or cuit_int = @p_cuit )
order by fecha_boletin desc
*/
declare @cant int = 0;
declare @respuesta table (nro int, provincia_boletin varchar(50), fechab varchar(10), fecha_boletin date, texto varchar(max))
insert into @respuesta
select distinct ROW_NUMBER() OVER (ORDER BY fecha_boletin desc) AS ROWID,
edictos.provincia_boletin, convert(varchar(10),cast(fecha_boletin as date),103) as fechab, fecha_boletin, texto
from edictos where (cuit_sociedad = @p_cuit or cuit_integrante = @p_cuit)
ORDER BY fecha_boletin desc
set @cant = (select COUNT(*) from @respuesta)
insert into @respuesta
select distinct (@cant + (ROW_NUMBER() OVER (ORDER BY fecha_publicacion desc))) AS ROWID,
--prv_nombre as provincia_boletin,
provincia_boletin = IIF(provincias.prv_nombre is null, sociedades_constituciones.provincia_sociedad, provincias.prv_nombre),
convert(varchar(11),fecha_publicacion,103) as fechab,fecha_publicacion, cast(contenido_archivo as varchar(max)) AS texto
from sociedades_constituciones
left join provincias on provincias.prv_codigo = provincia_boletin and pai_codigo_ifx = 54
where (documento_soc = @p_cuit or cuit_int = @p_cuit )
order by fecha_publicacion desc
select provincia_boletin, fechab, fecha_boletin, texto
from @respuesta a
where not exists (select * from @respuesta b where b.fecha_boletin = a.fecha_boletin and b.nro > a.nro)
order by fecha_boletin desc
END
GO
GO
--exec [obtener_edictos_prueba] 20250070498
--exec [obtener_edictos] 20250070498
CREATE OR ALTER PROCEDURE dbo.obtener_edictos_prueba
@p_cuit varchar(20)
AS
BEGIN
SET NOCOUNT ON;
/*
select distinct edictos.provincia_boletin,convert(varchar(10),cast(fecha_boletin as date),103) as fechab,fecha_boletin,texto
from edictos where (cuit_sociedad = @p_cuit or cuit_integrante = @p_cuit)
union
select distinct
provincia_boletin = IIF(provincias.prv_nombre is null, sociedades_constituciones.provincia_sociedad, provincias.prv_nombre),
convert(varchar(11),fecha_publicacion,103) as fechab,fecha_publicacion, cast(contenido_archivo as varchar(max)) AS texto
from sociedades_constituciones
left join provincias on provincias.prv_codigo = provincia_boletin and pai_codigo_ifx = 54
where (documento_soc = @p_cuit or cuit_int = @p_cuit )
order by fecha_boletin desc
*/
declare @cant int = 0;
declare @respuesta table (nro int, provincia_boletin varchar(50), fechab varchar(10), fecha_boletin date, texto varchar(max))
insert into @respuesta
select distinct ROW_NUMBER() OVER (ORDER BY fecha_boletin desc) AS ROWID,
edictos.provincia_boletin, convert(varchar(10),cast(fecha_boletin as date),103) as fechab, fecha_boletin, texto
from edictos where (cuit_sociedad = @p_cuit or cuit_integrante = @p_cuit)
ORDER BY fecha_boletin desc
set @cant = (select COUNT(*) from @respuesta)
insert into @respuesta
select distinct (@cant + (ROW_NUMBER() OVER (ORDER BY fecha_publicacion desc))) AS ROWID,
--prv_nombre as provincia_boletin,
provincia_boletin = IIF(provincias.prv_nombre is null, sociedades_constituciones.provincia_sociedad, provincias.prv_nombre),
convert(varchar(11),fecha_publicacion,103) as fechab,fecha_publicacion, cast(contenido_archivo as varchar(max)) AS texto
from sociedades_constituciones
left join provincias on provincias.prv_codigo = provincia_boletin and pai_codigo_ifx = 54
where (documento_soc = @p_cuit or cuit_int = @p_cuit )
order by fecha_publicacion desc
select provincia_boletin, fechab, fecha_boletin, texto
from @respuesta a
where not exists (select * from @respuesta b where b.fecha_boletin = a.fecha_boletin and b.nro > a.nro)
order by fecha_boletin desc
END
GO
Depends On
3Used By
No items found