-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
-- [C6Mart].[PL_S36ProfiloRischio] 'F','GRNNTN55B07I158D'
CREATE procedure [C6Mart].[PL_S36ProfiloRischio] 
	-- Add the parameters for the stored procedure here
	@Rete char(1), 
	@CodiceFiscale varchar(16)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SELECT 
		M.PROFILO_ASS AS codiceProfilo,
--		CR.DESCRIZIONE AS nomeProfilo,
		PR.NomeProfilo as nomeProfilo,
		dbo.ToShortDateString(M.DATA_INIZIO_VAL) AS dataInizioValidita,
		CR.MAX_VAR as varMassimo
	FROM
		C6Mart.MIFID AS M INNER JOIN
		C6Mart.CODIFICA_RISCHIO AS CR ON M.PROFILO_ASS = CR.PROFILO
		INNER JOIN
		dbo.ProfiliDiRischio as pr on
		pr.CodiceProfilo = cr.profilo
	WHERE
		M.RETE = @Rete AND
		M.COD_FISCALE = @CodiceFiscale
END