Function as CREATE FUNCTION StockBalance_AmountIn (@SortID int) RETURNS numeric (18,4) AS BEGIN Declare @dblReturn numeric (18,4) Select @dblReturn = SUM (AmountCurrentMonthIn) From AT_Materiel_StockBalance Where SortID = @SortID Return (@dblReturn) END call Method Select DBo.stockBalance_Amountin (2523) Here you need to add DBO