I believe you meant "not" rather than "now".
However, your first example is also non-deterministic. Here's the proof.
Create table dbo.SalesOrderHeader (RN INT IDENTITY(1,1),SomeDate DATETIME);
ALTER TABLE dbo.SalesOrderHeader ADD WhichDay AS datepart(day,'20180131') PERSISTED;
Msg 4936, Level 16, State 1, Line 1
Computed column 'WhichDay' in table 'SalesOrderHeader' cannot be persisted because the column is non-deterministic.
is pronounced "ree-bar
" and is a "Modenism
" for R
First step towards the paradigm shift of writing Set Based code:
________Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
"If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
"Change is inevitable... change for the better is not."
When you put the right degree of spin on it, the number 3|8
is also a glyph that describes the nature of a DBAs job. 😉
How to post code problems
Create a Tally Function (fnTally)