
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[p_grid_pr_products_introducers]
	@product_code ais_code_short,
	@branch_id int,
	@introducer_id as varchar(15)
AS

set nocount on;

	declare @id int

	if @introducer_id = '%' 
		set @id = 0
	else
		set @id = convert(int, @introducer_id)

select	i.*, v.*
from	vw_act_introducers v
		inner join pr_products_introducers i on act_actor_id = prdint_introducer_id
where	prdint_product_code = @product_code	
and		prdint_branch_id = @branch_id
and		(@id = 0 or act_actor_id = @id)

GO
