dbo.Clientes_

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@plataforma varchar 100

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
/*
exec Clientes_ 47
*/

-- =============================================
-- Author: Marita Soria
-- Create date: 30/11/2022
-- Description: Listado de clientes activos para una o varias plataformas que se envian en una lista
-- =============================================
CREATE OR ALTER PROCEDURE dbo.Clientes_ 
 @plataforma varchar(100) = '47,10,73'
 
AS
BEGIN

 SET NOCOUNT ON;



    SELECT clientes.cliente,clientes.cli_codigo,clientes.nombre_cliente, country.country_name, padrones.nombre_persona, padrones.identificacion
    FROM clientes 
    INNER JOIN 
     (select clientes_productos.cliente
     from clientes_productos 
     inner join clientes on clientes_productos.cliente = clientes.cliente
     INNER JOIN dbo.DelimitedSplit8K(@plataforma, ',') Prod ON clientes_productos.id_producto = Prod.Item
     where clientes.estado_cliente = 'A' and clientes_productos.activo=1 
     group by clientes_productos.cliente) activos ON clientes.cliente = activos.cliente
    INNER JOIN country ON clientes.country_code = country.country_code
    INNER JOIN padrones ON clientes.cuit = padrones.identificacion
    ORDER BY padrones.nombre_persona,clientes.nombre_cliente 


 
END
GO

Used By

No items found