Hi,
My question is: can I use GETDATE function in scalar UDF as below:
CREATE FUNCTION dbo.GetDateFunction()
RETURNS DateTime
AS
BEGIN
RETURN GetDate();
END
I have seen this UDF definition in tutorial,but I thought non-deterministic functions can not be used in UDF.
I also looked at two sites to find out but both says differently:
Technet:
https://technet.microsoft.com/en-us/library/aa175085(v=sql.80).aspx
states that functions that return different values on each call can not be used in UDF.
MSDN:
https://msdn.microsoft.com/en-us/library/ms191007.aspx
states that nondeterministic built-in functions can be used in Transact-SQL user-defined functions and in the list of functions GETDATE is listed.
Can someone please verify which one is true?
Thanks