The following SQL run against a table with 1 million records is giving the same value for columns Date1 and Date2, and it took 38 seconds to execute. Is this an expected behavior and why?
CREATE FUNCTION Fn_Test(@a decimal)RETURNS TABLE
AS
RETURN
(
SELECT @a Parameter, Getdate() Date1, PartitionTest.*
FROM PartitionTest
);
SELECT *, GETDATE() Date2 FROM Fn_Test(RAND(DATEPART(s,GETDATE())))
Is this some kind of caching?