Thank you. I just read a little further in my chapter in UDF's and read
about not being able to use nondeterministic functions. I guess I will
have to pass the date from code when I call the SP that calls the
function. Damn, there is always a "gotcha" in this stuff.
Thanks for your response
Keith S. Safford
Sr. Programmer
Energy Merchant, LLC
xxx-xxx-xxxx
keith.safford@e...
-----Original Message-----
From: karel.kreizel@v...
[mailto:karel.kreizel@v...]
Sent: Thursday, July 11, 2002 10:52 AM
To: sql language
Subject: [sql_language] Re: Using GetDate function in SQL UDF
> I am having trouble using the GetDate function in a User-defined
function
I> created. Below is the syntax of the function I am using along with
the
e> rror message:
> SELECT @dtNow =3D GETDATE()
> Server: Msg 443, Level 16, State 1, Procedure fn_GetNYMEXFuture, Line
22
I> nvalid use of 'getdate' within a function.
> Does anyone know of a way around this and why you cannot use SQL
functions
i> n your own UDF?
In BOL is written:
Built-in functions that can return different data on each call are not
allowed in user-defined functions. The built-in functions not allowed in
user-defined functions are:
@@CONNECTIONS @@PACK_SENT GETDATE
@@CPU_BUSY @@PACKET_ERRORS GetUTCDate
@@IDLE @@TIMETICKS NEWID
@@IO_BUSY @@TOTAL_ERRORS RAND
@@MAX_CONNECTIONS @@TOTAL_READ TEXTPTR
@@PACK_RECEIVED @@TOTAL_WRITE
Hi, Karel