Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Assembly |
Parameters
9| Name | Data Type | Length | Description |
|---|---|---|---|
| @accion | varchar | 50 | |
| @cliente | int | 4 | |
| @servicio_contratado | int | 4 | |
| @grupo | varchar | 10 | |
| @nombre | varchar | 500 | |
| @pais | varchar | 10 | |
| varchar | 200 | ||
| @user_id | int | 4 | |
| @idReg | int | 4 |
SQL Script
Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
select * from LN_cliente_datos_privados where email_grupo is not null
EXEC LN_cliente_tipo_servicio 'LISTAR', 1226057645,47
EXEC LN_cliente_tipo_servicio 'LISTAR', 1226057645,73
*/
CREATE OR ALTER PROCEDURE dbo.LN_cliente_tipo_servicio
@accion varchar(50),
@cliente int,
@servicio_contratado int,
@grupo varchar(10) = null,
@nombre varchar(500) = null,
@pais varchar(10) = NULL,
@email varchar(200) = NULL,
@user_id int = null,
@idReg int = null
AS
BEGIN
SET NOCOUNT ON;
if(@accion = 'LISTAR')
begin
select LN_cliente_datos_privados.*, country.country_name, productos.nombre_producto
from LN_cliente_datos_privados
left join country on country.country_code = LN_cliente_datos_privados.country_code
left join productos on productos.producto = LN_cliente_datos_privados.servicio_contratado
where cliente = @cliente and servicio_contratado in (@servicio_contratado) and visible=1 order by nombre_corto
end
if(@accion = 'SELECT')
begin
select LN_cliente_datos_privados.*, country.country_name, productos.nombre_producto
from LN_cliente_datos_privados
left join country on country.country_code = LN_cliente_datos_privados.country_code
left join productos on productos.producto = LN_cliente_datos_privados.servicio_contratado
where LN_cliente_datos_privados.idReg = @idReg
end
if (@accion = 'INSERT')
begin
insert into LN_cliente_datos_privados ( nombre_largo, nombre_corto, cliente, servicio_contratado, country_code, agrupacion, email_grupo ,visible, created, created_by)
values (@nombre, @nombre, @cliente, @servicio_contratado, isnull(@pais,'AR'), @grupo, @email, 1, GETDATE(), @user_id)
end
if (@accion = 'UPDATE')
begin
UPDATE LN_cliente_datos_privados
set nombre_largo = @nombre,
nombre_corto = @nombre,
cliente = @cliente,
servicio_contratado = @servicio_contratado,
country_code = isnull(@pais,country_code),
agrupacion = @grupo,
email_grupo = @email,
visible = 1,
modified = GETDATE(),
modified_by = @user_id
where LN_cliente_datos_privados.idReg = @idReg
end
if (@accion = 'DELETE')
begin
DELETE FROM LN_cliente_datos_privados
where LN_cliente_datos_privados.idReg = @idReg
end
END
GO
GO
/*
select * from LN_cliente_datos_privados where email_grupo is not null
EXEC LN_cliente_tipo_servicio 'LISTAR', 1226057645,47
EXEC LN_cliente_tipo_servicio 'LISTAR', 1226057645,73
*/
CREATE OR ALTER PROCEDURE dbo.LN_cliente_tipo_servicio
@accion varchar(50),
@cliente int,
@servicio_contratado int,
@grupo varchar(10) = null,
@nombre varchar(500) = null,
@pais varchar(10) = NULL,
@email varchar(200) = NULL,
@user_id int = null,
@idReg int = null
AS
BEGIN
SET NOCOUNT ON;
if(@accion = 'LISTAR')
begin
select LN_cliente_datos_privados.*, country.country_name, productos.nombre_producto
from LN_cliente_datos_privados
left join country on country.country_code = LN_cliente_datos_privados.country_code
left join productos on productos.producto = LN_cliente_datos_privados.servicio_contratado
where cliente = @cliente and servicio_contratado in (@servicio_contratado) and visible=1 order by nombre_corto
end
if(@accion = 'SELECT')
begin
select LN_cliente_datos_privados.*, country.country_name, productos.nombre_producto
from LN_cliente_datos_privados
left join country on country.country_code = LN_cliente_datos_privados.country_code
left join productos on productos.producto = LN_cliente_datos_privados.servicio_contratado
where LN_cliente_datos_privados.idReg = @idReg
end
if (@accion = 'INSERT')
begin
insert into LN_cliente_datos_privados ( nombre_largo, nombre_corto, cliente, servicio_contratado, country_code, agrupacion, email_grupo ,visible, created, created_by)
values (@nombre, @nombre, @cliente, @servicio_contratado, isnull(@pais,'AR'), @grupo, @email, 1, GETDATE(), @user_id)
end
if (@accion = 'UPDATE')
begin
UPDATE LN_cliente_datos_privados
set nombre_largo = @nombre,
nombre_corto = @nombre,
cliente = @cliente,
servicio_contratado = @servicio_contratado,
country_code = isnull(@pais,country_code),
agrupacion = @grupo,
email_grupo = @email,
visible = 1,
modified = GETDATE(),
modified_by = @user_id
where LN_cliente_datos_privados.idReg = @idReg
end
if (@accion = 'DELETE')
begin
DELETE FROM LN_cliente_datos_privados
where LN_cliente_datos_privados.idReg = @idReg
end
END
GO
Depends On
3Used By
No items found