August 2, 2004 at 6:54 am
Hi,
I'm new in SQL, is it not posible to call a GETDATE() in a user defined function
Thanks!
Thomas Vanting
August 2, 2004 at 2:10 pm
you cannot use Getdate() in a udf, Look for deterministic functions in bol.
August 2, 2004 at 5:14 pm
However you can provide a parameter in the UDF to submit GETDATE() thru.
August 2, 2004 at 11:11 pm
Okay, thanks
Thomas Vanting
August 3, 2004 at 10:27 am
If you need the current date in a UDF you can also fudge it a little bit by performing the following query in the UDF :
DECLARE @dtDate datetime
SELECT @dtDate = convert(datetime, convert(varchar(20), last_batch, 101))
FROM master..sysprocesses
WHERE spid = @@spid
August 4, 2004 at 11:26 pm
The easiest way to use GETDATE() in a UDF is to create a view that calls GETDATE() and use the view in the function.
Razvan
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply