-- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE FUNCTION [C6MartPeriodico].[getIdElab] ( ) RETURNS int AS BEGIN -- Declare the return variable here DECLARE @ID_ELAB AS INT SELECT @ID_ELAB = ISNULL(MAX(ID_ELAB),0) FROM C6MARTPERIODICO.ELABORAZIONI -- Return the result of the function RETURN @ID_ELAB END