CREATE FUNCTION [dbo].[AverageSale_fns]
(
-- Add the parameters for the function here
--
)
RETURNS money
AS
BEGIN
-- Declare the return variable here
DECLARE @Result money
-- Add the T-SQL statements to compute the return value here
SET @Result =(SELECTAvg(TotalSale)AS AverageSale
FROM dbo.SalesTotals_fnt())
-- Return the result of the function
RETURN @Result
END
用户评论