whether datename() is deterministic or nondeterministic

  •  While refering the updated books online of sql server 2000 ..:

     

    Transact sql reference->functions->datetime functions

    I found that "datename()" function is stated as non deterministic function.

    I think its deterministic function.

    What u think ? its books online mistake? or my view is wrong ?

     

    Vidyadhar

  • what is deterministic and non deterministic?

    whats diff between them,

    i guess its non-deterministic, becoz the value get is not certain or fixed

    its value changes

     

    <a href="http://www.websolsoftware.com"> For IT jobs click here</a>

    *Sukhoi*[font="Arial Narrow"][/font]

  • From BOL:

    All functions are deterministic or nondeterministic:

    Deterministic functions always return the same result any time they are called with a specific set of input values.

    Nondeterministic functions may return different results each time they are called with a specific set of input values.

    As for DATENAME() - it's non-deterministic. Here's a simple example where you call the function with the same arguments, yet it gives different results.

    set language us_english

    select datename(weekday, '2004-09-21')

    set language svenska

    select datename(weekday, '2004-09-21')

    Changed language setting to us_english.

                                  

    ------------------------------

    Tuesday

    Changed language setting to Svenska.

                                  

    ------------------------------

    tisdag

    Most datefunctions are language sensitive, hence they are also nondeterministic.

    /Kenneth

     

  • So why can't they be used in UDFs?

  • There is a lot of good info on userdefined functions to be found in BOL. (Books On Line) The answer to many questions can be found there

    /Kenneth

  • Dont divert from the main question

  • If you're interested in the reasons as to why MS has implemented UDFs in a way that not allows nondeterministic functions to be included, Books On Line is a good place to start to get an understanding about the concepts.

    BOL is there for everyone to use, and it should be your first choice of source for information and help. 

    As for the original question posted, that has already been answered in this thread.

    /Kenneth

     

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply