sql server - Non Deterministic Function -


sql server telling me function non deterministic. confused because given date x return same.

dateadd(d, 13 - datediff(d, '9/23/10', servicedate) % 14, servicedate) 

  convert(date,  dateadd(d, 13 - datediff(d, convert(date, '9/23/10',101), servicedate) % 14, servicedate),101) 

when refer date data type string literals in indexed computed columns in sql server, recommend explicitly convert literal date type want using deterministic date format style. list of date format styles deterministic, see cast , convert. expressions involve implicit conversion of character strings date data types considered nondeterministic, unless database compatibility level set 80 or earlier. because results depend on language , dateformat settings of server session. example, results of expression convert (datetime, '30 listopad 1996', 113) depend on language setting because string '30 listopad 1996' means different months in different languages. similarly, in expression dateadd(mm,3,'2000-12-01'), database engine interprets string '2000-12-01' based on dateformat setting.

cast

deterministic unless used datetime, smalldatetime, or sql_variant.

convert

deterministic unless 1 of these conditions exists:

...

source or target type datetime or smalldatetime, other source or target type character string, , nondeterministic style specified. deterministic, style parameter must constant. additionally, styles less or equal 100 nondeterministic, except styles 20 , 21. styles greater 100 deterministic, except styles 106, 107, 109 , 113.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -