The date of the data type of the operand is not valid for the subtraction operator
I have a field in my table called [LastDate] with DataType Date
. and I'm going to write a function that calculates [LastDate]-@PassedParameter
, but an error occurs:
Operand data type date is invalid for subtract operator.
I do not know why?
hara is a function:
CREATE FUNCTION Salman( @Date date )
RETURNS TABLE
AS
RETURN
(
SELECT TOP 1000 [ID]
,[Name]
,[LastDate]
,[Rule]
,[CoA]
FROM [Scheduling_Employee].[dbo].[Group]
where ([LastDate]-@Date)%[Rule]=0
)
GO
+3
source to share