I have this functionCreate FUNCTION dbo.monthlyClaimUtilization (@from as datetime = '1/1/1900', @to as datetime = '1/1/1900', @groupNum nvarchar(6)='%')RETURNS table
It worked fine until I tried to reset the value of @to when it had the default valueI tried thisSelect case @to When '1/1/1900' then DATEADD(d, - (DATEPART(d,Getdate())), Getdate()) else @to
and thisIf @to = '1/1/1900' Set @to = DATEADD(d, - (DATEPART(d,Getdate())), Getdate())
with and without the word BEGIN before and with the word RETURN after. But I always get one or two errors of the following: Invalid use of 'getdate' within a functionIncorrect syntax near the keyword 'Select'Incorrect syntax near 'BEGIN'Incorrect syntax near ')'A candle loses nothing by lighting another candle 