sql - Non Deterministic issues with Persisted Columns whilst working with datetime -
as i've spent 2 hours trying fix , couldn't find answer on so, i've decided add new question. in hindsight, answer can answered on so, if you're looking in right place.
problem: whilst trying persist calculated column (which in case includes cast('2013-09-30 23:59:59' datetime)
in sql server error advising cannot persisted non-deterministic
.
solution: use convert
rather cast
, specify style
, example convert(datetime,'2013-09-30 23:59:59',120)
. in example, 120
style , refers yyyy-mm-dd hh:mi:ss format.
caveat: have seen posts suggesting styles can non-deterministic, check out http://msdn.microsoft.com/en-us/library/ms187928.aspx full run down on styles.
Comments
Post a Comment