datename() function- deterministic/non-deterministic

  • 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

  • From BOL ("deterministic functions" in the index keyword search):

    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.

    DATENAME / DATEPART always return the same value when called with a specific set of parameters and hence is deterministic...

    however something like this: SELECT DATENAME(ms,getdate()) will return different values each time -- and that is because getdate() is the Nondeterministic function affecting the deterministic function...

    I think.........

     

    p.s.: The suggestions forum (this one) is used to give suggestions related to the site to the site owners...you would be better off posting in the T-SQL or General forums with such queries...

Viewing 2 posts - 1 through 1 (of 1 total)

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