我使用下面的代码来创建函数但是当我想执行它时发生错误
CREATE FUNCTION getFactorPriceFunction
(
@factorCode BIGINT
)
RETURNS bigint
AS BEGIN
RETURN
(
select SUM(price*coun) as total from CustomerFactor inner join CustomerFactorDetails
on CustomerFactor.code=CustomerFactorDetails.factorCode inner join ProductDetails on
ProductDetails.code=CustomerFactorDetails.productDetailsCode
where factorCode=@factorCode AND final=1
)
END
执行:
select total from getFactorPriceFunction(100)
错误:
无效的对象名称“getFactorPriceFunction”