Home All Groups Group Topic Archive Search About

User Function Date parameter

Author
12 Jan 2006 11:54 PM
AkAlan
I'm trying to create a User Defined Function which will return only records
with a date earlier than the current date. I tried using ,GETDATE() in the
criteria block of the date field but when I try to save the function I get
the error "ADO Error: Invalid use of 'getdate' within a function. I suppose I
could just make it a variable and then pass the current date to it but I
think the function should grab the date by itself. Anyone know why it won't?
Thanks

Author
13 Jan 2006 12:05 AM
ML
You have two options:

1) pass the date as a parameter (fast) ; or

2) create a view such as:
create view vNow
as
select getdate() as Now
go

....and get the current time from the view.
(slow)

Choose your weapon. :)


ML

---
http://milambda.blogspot.com/
Author
13 Jan 2006 12:23 AM
Jens
No, you have to pass the date to the function.

HTH, Jens Suessmeyer.

AddThis Social Bookmark Button