SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE procedure [dbo].[p_xml_policy_export]
	@policy_situation_id int
AS

	select	* 
	from	pol_policies
			inner join act_clients on cli_actor_id = pol_client_id
			inner join pol_policies_situations on pols_policy_id = pol_policy_id
			inner join pol_cpl on pcpl_policy_situation_id = pols_policy_situation_id
			inner join ris_risks on ris_policy_id = pols_policy_id
			inner join ris_risks_situations on riss_risk_id = ris_risk_id
			inner join ris_cpl on rcpl_risk_situation_id = riss_risk_situation_id
	where	pols_policy_situation_id = @policy_situation_id
	for xml auto, elements
GO
