Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
5| Name | Data Type | Length | Description |
|---|---|---|---|
| @p_id_generalidades | int | 4 | |
| @p_Cuit | varchar | 20 | |
| @p_visible | bit | 1 | |
| @p_producto | int | 4 | |
| @p_id_seccion | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE OR ALTER PROCEDURE dbo.backend_datos_generales
@p_id_generalidades int, -- si viene nulo busca los otros dos campos, si viene con valor solo busca por este id.
@p_Cuit varchar(20),
@p_visible bit,
@p_producto int,
@p_id_seccion int = null
AS
BEGIN
SET NOCOUNT ON;
/*
if (@p_id_generalidades is not null)
begin
set @p_cuit = null
set @p_visible = null
end
begin
select id_datos_generales, titulo, texto,
replace(convert(varchar(255), texto),char(10),'<br>') as mostrar,
replace(convert(varchar(max), texto),char(10),'<br>') as texto_formateado,
datos_generales.id_seccion,
productos_secciones.nombre_seccion,
datos_generales.visible as visible,
estado = case datos_generales.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end
from datos_generales
left join productos_secciones on productos_secciones.producto = @p_producto
and productos_secciones.id_seccion = datos_generales.id_seccion
where (@p_Cuit is not null and
cuit = @p_Cuit
and datos_generales.visible = @p_visible
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
)
or (@p_id_generalidades is not null and
id_datos_generales = @p_id_generalidades
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
)
order by modified_by desc
end
*/
if (@p_id_generalidades is not null)
begin
set @p_cuit = null
set @p_visible = null
end
if (@p_id_generalidades is not null)
begin
select id_datos_generales, titulo, texto,
replace(convert(varchar(255), texto),char(10),'<br>') as mostrar,
replace(convert(varchar(max), texto),char(10),'<br>') as texto_formateado,
datos_generales.id_seccion,
productos_secciones.nombre_seccion,
datos_generales.visible as visible,
estado = case datos_generales.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end
from datos_generales
left join productos_secciones on productos_secciones.producto = @p_producto
and productos_secciones.id_seccion = datos_generales.id_seccion
where id_datos_generales = @p_id_generalidades
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
order by modified_by desc
end
else
begin
select id_datos_generales, titulo, texto,
replace(convert(varchar(255), texto),char(10),'<br>') as mostrar,
replace(convert(varchar(max), texto),char(10),'<br>') as texto_formateado,
datos_generales.id_seccion,
productos_secciones.nombre_seccion,
datos_generales.visible as visible,
estado = case datos_generales.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end
from datos_generales
left join productos_secciones on productos_secciones.producto = @p_producto
and productos_secciones.id_seccion = datos_generales.id_seccion
where (cuit = @p_Cuit
and datos_generales.visible = @p_visible
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
)
order by modified_by desc
end
END
GO
GO
CREATE OR ALTER PROCEDURE dbo.backend_datos_generales
@p_id_generalidades int, -- si viene nulo busca los otros dos campos, si viene con valor solo busca por este id.
@p_Cuit varchar(20),
@p_visible bit,
@p_producto int,
@p_id_seccion int = null
AS
BEGIN
SET NOCOUNT ON;
/*
if (@p_id_generalidades is not null)
begin
set @p_cuit = null
set @p_visible = null
end
begin
select id_datos_generales, titulo, texto,
replace(convert(varchar(255), texto),char(10),'<br>') as mostrar,
replace(convert(varchar(max), texto),char(10),'<br>') as texto_formateado,
datos_generales.id_seccion,
productos_secciones.nombre_seccion,
datos_generales.visible as visible,
estado = case datos_generales.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end
from datos_generales
left join productos_secciones on productos_secciones.producto = @p_producto
and productos_secciones.id_seccion = datos_generales.id_seccion
where (@p_Cuit is not null and
cuit = @p_Cuit
and datos_generales.visible = @p_visible
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
)
or (@p_id_generalidades is not null and
id_datos_generales = @p_id_generalidades
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
)
order by modified_by desc
end
*/
if (@p_id_generalidades is not null)
begin
set @p_cuit = null
set @p_visible = null
end
if (@p_id_generalidades is not null)
begin
select id_datos_generales, titulo, texto,
replace(convert(varchar(255), texto),char(10),'<br>') as mostrar,
replace(convert(varchar(max), texto),char(10),'<br>') as texto_formateado,
datos_generales.id_seccion,
productos_secciones.nombre_seccion,
datos_generales.visible as visible,
estado = case datos_generales.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end
from datos_generales
left join productos_secciones on productos_secciones.producto = @p_producto
and productos_secciones.id_seccion = datos_generales.id_seccion
where id_datos_generales = @p_id_generalidades
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
order by modified_by desc
end
else
begin
select id_datos_generales, titulo, texto,
replace(convert(varchar(255), texto),char(10),'<br>') as mostrar,
replace(convert(varchar(max), texto),char(10),'<br>') as texto_formateado,
datos_generales.id_seccion,
productos_secciones.nombre_seccion,
datos_generales.visible as visible,
estado = case datos_generales.visible
when 1 then 'ACTIVO'
when 0 then 'INACTIVO'
end
from datos_generales
left join productos_secciones on productos_secciones.producto = @p_producto
and productos_secciones.id_seccion = datos_generales.id_seccion
where (cuit = @p_Cuit
and datos_generales.visible = @p_visible
and (@p_id_seccion is null or datos_generales.id_seccion = @p_id_seccion)
)
order by modified_by desc
end
END
GO
Depends On
2Used By
No items found