SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[p_grid_act_actors]
    @type_code ais_code_short = '%',
    @actor_id int
AS 
	set nocount on

	if @type_code = 'CLI'
	begin	
		select *
		from act_actors
			inner join adr_adresses on act_address_id = adr_adress_id
			inner join act_clients on act_actor_id = cli_actor_id
			left join act_cpl on act_actor_id = acpl_acteur_id
		where	act_type_code = @type_code 
				and ( @actor_id = 0 or act_actor_id = @actor_id) 
	end 
		
    



GO
