@PaulWhite So it's faster to use
DATETRUNC
because it returns the same data type you give it, whereas
CAST AS date
needs to convert back to
datetime2
again because
DATEDIFF
doesn't accept
date
, correct? Interesting that the query plan doesn't show any of this conversion
dbfiddle.uk/QAuVai8W (but not hugely surprising, we know it's only a vague indication of what's actually going on)