-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date, ,>
-- Description:	<Description, ,>
-- =============================================
CREATE FUNCTION [C6Mart].[getTipoElab]
(
)
RETURNS VARCHAR(1)
AS
BEGIN
	-- Declare the return variable here
	DECLARE @TIPO_ELAB AS VARCHAR(1)
	DECLARE @ID_ELAB AS INT
	SELECT @ID_ELAB = MAX(ID_ELAB) 
	FROM C6MART.ELABORAZIONI 
	SELECT @TIPO_ELAB = TIPO_ELAB 
	FROM C6MART.ELABORAZIONI 
	WHERE ID_ELAB = @ID_ELAB
	-- Return the result of the function
	RETURN @TIPO_ELAB
END