--[C6MartPeriodico].[GetRiskArea] 'S', 'GLLRFL52L02L219D'
CREATE procedure [C6MartPeriodico].[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
		C6MartPeriodico.mifid a
		left outer join C6MartPeriodico.CODIFICA_RISCHIO b
		on A.PROFILO_ASS=B.PROFILO
	WHERE
		a.COD_FISCALE = @CodiceFiscale
		and a.RETE= @Rete
END