-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date, ,>
-- Description:	<Description, ,>
-- =============================================
CREATE   FUNCTION [C6Staging].[getImportoSpesa]
(
	-- Add the parameters for the function here
	@Rete varchar(2),
	@Codice_fiscale varchar(16)
)
RETURNS VARCHAR(255)
AS
BEGIN
	-- Declare the return variable here
	DECLARE @ValoreParametro decimal(15,2)
	SELECT	@ValoreParametro=isnull(ImportoSpesa,0.00)
	FROM	c6mart.Mifid
	WHERE	RETE=@Rete and COD_FISCALE=@Codice_fiscale
	-- Return the result of the function
	RETURN @ValoreParametro
END