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