-- Schema: C6Mart
-- Stored Procedure: GetRiskArea




--[C6Mart].[GetRiskArea] 'S', 'GLLRFL52L02L219D'
CREATE procedure [C6Mart].[GetRiskArea]
-- Add the parameters for the stored procedure here
 @Rete char(1), 
 @CodiceFiscale varchar(16)

AS
BEGIN

	select

		case 
			when b.profilo is null then -1 
			else b.profilo
		end as profiloCode

	FROM
		c6mart.mifid a
		left outer join C6Mart.CODIFICA_RISCHIO b
		on A.PROFILO_ASS=B.PROFILO
	WHERE

		a.COD_FISCALE = @CodiceFiscale
		and a.RETE= @Rete

END