How to replace DateSerial in SQL Server Stored Procedure ?
Posted on 2005-04-11
The following statement works fine in my Access application but when I moved it into SQL Server as a stored procedure,
I get the error message:
Error 195: DateSerial is not a recognized function name:
((tblCustomers.DateLost)<=DateSerial(Year(#" & Me.dtFullDate & "#)-[tblStatesAll].[BondsFS],6,30))
Could you tell me what function I could use to replace DateSerial in the context I am using it above. I would really appreciate it if you could show me the implementation of the replacement function in my SQL statement above.
The value returned by tblStatesAll.BondsFS is an integer value between 1 and 5. For example if BondsFS is 4 and
Me.dtFullDate is 1/1/2004. The DateSerial(Year(#1/1/2004#)-4,6,30) is 6/30/2004. Thus, the result is
DateLost <= 6/30/2000 in my example.
My question is how would I write this in SQL Server stored procedure since I cannot use DateSerial.