SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_acc_account_actors_by_table_id]
	@table_id type_table_id READONLY
as 
	set nocount on;
	
	/*
	[DGE]
	Elle renvoie:
	- la table acc_accounts
	- la table acc_bordereaux;
	- la table acc_payments
	- la table claim_variables_accounts
	- la table acc_cl_bordereaux_accounts
		*/
	
	select	a.*
	from	acc_accounts a
			inner join @table_id t on t.id = a.a_account_id
	
	SELECT	b.*
	FROM	acc_bordereaux b
			INNER JOIN @table_id t on t.id = b.bdr_bordereau_id
	
	SELECT	p.*
	FROM	acc_payments p 
			INNER JOIN @table_id t on t.id = p.pay_payment_id

	select	c.*
	from	claim_variables_accounts c
			inner join @table_id t on t.id = c.clacc_account_id


	select	c.*
	from	acc_cl_bordereaux_accounts c
			inner join @table_id t on t.id = c.clba_account_id 
GO
