Christian Buettner (2/13/2008)
Hm, I am having a blackout:Why is this function not deterministic?!?
CREATE FUNCTION dbo.fnDateAdd()
RETURNS int
AS
BEGIN
RETURN 0
END
GO
Do I need to have any special session settings enabled?
SELECT objectpropertyex(object_id('dbo.fnDateAdd'), N'IsDeterministic')
returns 0.
I am stuck... 🙁
Btw: I prefer "wrong" questions with discussions that start your brain on a topic over questions where I just get my points.
It IS deterministic, and SQL Server knows it - but somehow that setting never gets set:).
Prove it to yourself.
create function dbo.fndateadd2()
returns int
as begin
return dbo.fndateadd()
end
go
It won't let you use anything non-deterministic when creating a function, ergo QED.
Long way to get to "that ObjectProperty be broke" part....:)
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?