home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,057 of 19,505   
   Erland Sommarskog to Gene Wirchenko   
   Re: IsDeterministic(), IsPrecise(), and    
   06 Jan 11 13:35:47   
   
   XPost: microsoft.public.sqlserver.programming   
   From: esquel@sommarskog.se   
      
   Gene Wirchenko (genew@ocis.net) writes:   
   >      I thought that the determination was if the input parameters are   
   > the same and the database state is the same, then yes.  To me,   
   > changing the database state would mean that all bets are off.   
   >   
   >           create function dbo.contrived()   
   >           returns int   
   >           as return 1   
   >   
   >      The above function is supposedly not deterministic.  It does not   
   > touch any database!  The example that got me going was an interest   
   > calculation function that took rate, amount, from date, and to date.   
   > It did not touch a database either.   
      
   I guess it is a limitation or a simplification.   
      
   WITH SCHEMABINDING gives a required, but not sufficient condition, that   
   the function is deterministic. That is simply what Microsoft has decided.   
   They could maybe have designed it differently, but then they would have   
   had to run more complex analysis when the function is used, and when the   
   function is altered or dropped.   
      
   To the price that we users have to add WITH SCHEMABINDING to make our   
   function deterministic. A fairly small price, I would say.   
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca