Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
6| Name | Data Type | Length | Description |
|---|---|---|---|
| @accion | varchar | 50 | |
| @p_web_id | smallint | 2 | |
| @p_app_id | tinyint | 1 | |
| @p_cliente | int | 4 | |
| @p_sender | varchar | 50 | |
| @p_servicio | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
/*
select * from fide_apps
*/
-- Description: <Description,,>
-- =============================================
create OR ALTER PROCEDURE dbo.multi_web_ANT
-- Add the parameters for the stored procedure here
@accion varchar(50) = null,
@p_web_id smallint = null,
@p_app_id tinyint = null,
@p_cliente int = null,
@p_sender varchar(50) = null,
@p_servicio int = null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@accion = 'disponibles') begin
if (@p_app_id is not null)
select * from multi_web where app_id = @p_app_id and cliente IS NULL and isnull(is_default,0) = 0 order by web_name
else
select * from multi_web where cliente IS NULL and isnull(is_default,0) = 0 order by web_name
end else
if (@accion = 'asignar') begin
if (@p_web_id is not null and @p_cliente is not null) begin
declare @app_id tinyint
/* al asignar una personalización a un cliente, tengo que sacarlo de todas las otras de la misma app_id */
select @app_id = app_id from multi_web where web_id = @p_web_id
update multi_web set cliente = NULL, sender = NULL where app_id = @app_id and cliente = @p_cliente
update multi_web set cliente = @p_cliente , sender = @p_sender where web_id = @p_web_id
end
end else
if (@accion = 'desasignar') begin
update multi_web set cliente = NULL , sender = NULL where cliente = @p_cliente
end else
if (@accion = 'asignados') begin
select * from multi_web where cliente = @p_cliente order by web_name
end else
if (@accion = 'asignables') begin
select multi_web.*, clientes.nombre_cliente from multi_web left outer join clientes on multi_web.cliente = clientes.cliente where isnull(is_default,0) = 0 order by web_name
end
if (@accion = 'cliente') begin
if (@p_app_id is not null)
begin
if (@p_servicio is null)
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.app_id = @p_app_id
and multi_web.cliente = @p_cliente
and multi_web.active = 1
else
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.app_id = @p_app_id
and multi_web.servicio_contratado = @p_servicio
and multi_web.cliente = @p_cliente
and multi_web.active = 1
end
else
begin
if (@p_servicio is null)
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.cliente = @p_cliente
and multi_web.active = 1
else
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.cliente = @p_cliente
and multi_web.servicio_contratado = @p_servicio
and multi_web.active = 1
end
end
END
GO
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
/*
select * from fide_apps
*/
-- Description: <Description,,>
-- =============================================
create OR ALTER PROCEDURE dbo.multi_web_ANT
-- Add the parameters for the stored procedure here
@accion varchar(50) = null,
@p_web_id smallint = null,
@p_app_id tinyint = null,
@p_cliente int = null,
@p_sender varchar(50) = null,
@p_servicio int = null
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
if (@accion = 'disponibles') begin
if (@p_app_id is not null)
select * from multi_web where app_id = @p_app_id and cliente IS NULL and isnull(is_default,0) = 0 order by web_name
else
select * from multi_web where cliente IS NULL and isnull(is_default,0) = 0 order by web_name
end else
if (@accion = 'asignar') begin
if (@p_web_id is not null and @p_cliente is not null) begin
declare @app_id tinyint
/* al asignar una personalización a un cliente, tengo que sacarlo de todas las otras de la misma app_id */
select @app_id = app_id from multi_web where web_id = @p_web_id
update multi_web set cliente = NULL, sender = NULL where app_id = @app_id and cliente = @p_cliente
update multi_web set cliente = @p_cliente , sender = @p_sender where web_id = @p_web_id
end
end else
if (@accion = 'desasignar') begin
update multi_web set cliente = NULL , sender = NULL where cliente = @p_cliente
end else
if (@accion = 'asignados') begin
select * from multi_web where cliente = @p_cliente order by web_name
end else
if (@accion = 'asignables') begin
select multi_web.*, clientes.nombre_cliente from multi_web left outer join clientes on multi_web.cliente = clientes.cliente where isnull(is_default,0) = 0 order by web_name
end
if (@accion = 'cliente') begin
if (@p_app_id is not null)
begin
if (@p_servicio is null)
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.app_id = @p_app_id
and multi_web.cliente = @p_cliente
and multi_web.active = 1
else
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.app_id = @p_app_id
and multi_web.servicio_contratado = @p_servicio
and multi_web.cliente = @p_cliente
and multi_web.active = 1
end
else
begin
if (@p_servicio is null)
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.cliente = @p_cliente
and multi_web.active = 1
else
select multi_web.*, clientes.nombre_cliente
from multi_web inner join clientes on multi_web.cliente = clientes.cliente
where multi_web.cliente = @p_cliente
and multi_web.servicio_contratado = @p_servicio
and multi_web.active = 1
end
end
END
GO
Depends On
2Used By
No items found