找不到列“dbo”或用户定义的函数或聚合“dbo.fn_IntCalc”,或者名称不明确

时间:2015-03-23 19:02:05

标签: sql-server tsql

当我尝试调用用户定义的函数时出现此错误

  

找不到任何一列" dbo"或用户定义的函数或   聚合" dbo.fn_IntCalc",或名称含糊不清

这是用户定义的函数:

CREATE FUNCTION dbo.fn_IntCalc (@IntersetRate NUMERIC(6, 3) = 10,
                                @Amount       NUMERIC(18, 5),
                                @FromDate     DATE,
                                @ToDate       DATE)
RETURNS NUMERIC(18, 5)
WITH EXECUTE AS CALLER
AS
  BEGIN
      DECLARE @IntCalculated NUMERIC(18, 5)

      SELECT @IntCalculated = @Amount * ( ( @IntersetRate / 100.0 ) 
             * ( DATEDIFF(d, @FromDate, @ToDate) / 365.0 ) )

      RETURN ( ISNULL(@IntCalculated, 0) )
  END

GO 

呼叫部分是:

SELECT dbo.fn_IntCalc(DEFAULT,2000,'Mar 1 2008','Mar 10 2008')

1 个答案:

答案 0 :(得分:1)

请尝试

SELECT * FROM dbo.fn_IntCalc(DEFAULT,2000,'Mar 1 2008','Mar 10 2008')

希望有所帮助