I am trying to create a persisted computed column using CASE expression:
ALTER TABLE dbo.Calendar ADD PreviousDate AS
case WHEN [Date]>'20100101' THEN [Date]
ELSE NULL
END PERSISTED
MSDN clearly says that CASE is deterministic, here
However, I am getting an error:
Msg 4936, Level 16, State 1, Line 1
Computed column 'PreviousDate' in
table 'Calendar' cannot be persisted
because the column is
non-deterministic.
Of course, i can create a scalar UDF and explicitly declare it as deterministic, but is there a simpler way around this? I am already in the middle of getting the latest service pack. Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…