函数如下
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
调用方法
select dbo.StockBalance_AmountIn(2523)
这里头需要加dbo