
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_act_all_info]
	@actor_id int
as

	set nocount on;

	declare @type_code ais_code_short

	select @type_code = act_type_code
	from act_actors
	where act_actor_id = @actor_id

	if not @type_code is null
	begin
	if @type_code = 'CLI'
		select *
		from vw_act_clients
		where act_actor_id = @actor_id 
	else if @type_code = 'INT' 
		select *
		from vw_act_introducers
		where act_actor_id = @actor_id 
	else if @type_code = 'BRA' 
		select *
		from vw_act_branches
		where act_actor_id = @actor_id 
	else if @type_code = 'CIE' 
		select *
		from vw_act_cies
		where act_actor_id = @actor_id
	else if @type_code = 'BNK' 
		select *
		from vw_act_banks
		where act_actor_id = @actor_id
	else if @type_code = 'TAX' 
		select *
		from vw_act_tax_entities
		where act_actor_id = @actor_id
	else if @type_code = 'TRT' 
		select *
		from vw_act_treaties
		where act_actor_id = @actor_id
	else
		select *
		from vw_act_others 
		where act_actor_id = @actor_id
		
	end



GO
