
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_grid_pr_products_variables_introducers]
	@product_code ais_code_short,
	@branch_id int,
    @introducer_id int = 0
AS 
	set nocount on

	select	vi.*, i.*, v.prdv_variable_code, v.prdv_variable_date_setup
	from	pr_products_variables_introducers vi
			inner join vw_act_introducers i on i.act_actor_id = vi.prdvi_introducer_id
			inner join pr_products_variables v on v.prdv_variable_id = vi.prdvi_variable_id 
	where	prdvi_product_code = @product_code
	and		prdvi_branch_id = @branch_id
	AND		(
			@introducer_id = 0 or prdvi_introducer_id = @introducer_id 
			)





GO
