dbo.LN_cliente_productos_pais

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

2
Name Data Type Length Description
@p_cliente int 4
@p_country_code varchar 2

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE OR ALTER PROCEDURE dbo.LN_cliente_productos_pais 
 -- Add the parameters for the stored procedure here
 @p_cliente           int,
 @p_country_code          varchar(2)
 
AS
BEGIN
 -- SET NOCOUNT ON added to prevent extra result sets from
 -- interfering with SELECT statements.
 SET NOCOUNT ON;

    -- Insert statements for procedure here

 select LN_cliente_productos.cliente, LN_cliente_productos.producto, 
  LN_cliente_productos.activo, LN_cliente_productos.created_by,
  LN_cliente_productos.modified_by, LN_cliente_productos.visibilidad_default,
  LN_cliente_productos.orden_producto,
  CONVERT(VARCHAR(19), LN_cliente_productos.created, 121) AS created,
  CONVERT(VARCHAR(19), LN_cliente_productos.modified, 121) AS modified,
  users.first_name + ' ' + users.last_name as created_by_user,
  users2.first_name + ' ' + users2.last_name as modified_by_user,
  clientes.nombre_cliente, LN_productos.nombre_producto, LN_productos.country_code,
  country.country_name
 from LN_cliente_productos
 inner join clientes on LN_cliente_productos.cliente = clientes.cliente
 inner join LN_productos on LN_cliente_productos.producto = LN_productos.producto
 inner join country on LN_productos.country_code = country.country_code
 inner join users on LN_cliente_productos.created_by = users.user_id
 left outer join users AS users2 on LN_cliente_productos.modified_by = users2.user_id
 where LN_cliente_productos.cliente = @p_cliente
 and LN_productos.country_code = @p_country_code
 and LN_cliente_productos.activo = 1
 and LN_productos.visible = 1
 order by clientes.nombre_cliente, 
  LN_cliente_productos.orden_producto,
  country.country_name, LN_productos.nombre_producto 


END

GO

Used By

No items found