Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 IsDeterministic?

Author  Topic 

daidaluus
Yak Posting Veteran

73 Posts

Posted - 2009-10-31 : 09:22:36
I tried to build a scaler funtion that meet all requirements to be deterministic. but i failed. after a few tests i came to this test:

CREATE FUNCTION fn1()
RETURNS int
AS
BEGIN
RETURN 1
END

when i query IsDeterministic of this function it returns 0

SELECT OBJECTPROPERTYEX(OBJECT_ID('fn1'), 'IsDeterministic')

but when i add WITH SCHEMABINDING clause to the function it will be IsDeterministic. i didnt see anywhere (including BOL) that SCHEMABINDING is a MUST for a function to be evaluated as deterministic. so is it true or is miss something?

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-10-31 : 11:01:05
UDF must be specified WITH SCHEMA BINDING if you want it to be deterministic. Not clearly pointed out in BOL, so no, I don't think you missed it. BOL for SQL 2000 showa it in the sample code, but doesn't explain it in any detail.
Go to Top of Page
   

- Advertisement -