I already have a function in SQL Server 2005:
ALTER function [dbo].[fCalculateEstimateDate] (@vWorkOrderID numeric) Returns varchar(100) AS Begin <Function Body> End
I want to change this function to accept the optional @ToDate extra parameter. I am going to add logic to a function if @Todate Provided, and then do something else with existing code.
I changed the function as:
ALTER function [dbo].[fCalculateEstimateDate] (@vWorkOrderID numeric,@ToDate DateTime=null) Returns varchar(100) AS Begin <Function Body> End
Now I can call the function as:
SELECT dbo.fCalculateEstimateDate(647,GETDATE())
But it gives an error on the following call:
SELECT dbo.fCalculateEstimateDate(647)
but
Not enough arguments were provided for the procedure or function dbo.fCalculateEstimateDate.
which, in my understanding, should not occur.
Did I miss something? Thanks in advance.
sql sql-server-2005
MaxRecursion 04 Oct 2018-12-12T00: 00Z
source share