Andy Brownsword gets beyond SQL Server 2000:
Date handling in SQL Server tends to accumulate tried and trusted combinations of
DATEPART(),DATEADD(), andDATEDIFF()– with nested variations. The challenge with these isn’t raw performance, but more with conveying intent and readability.So let’s look at some simpler patterns to try and avoid some of these and be clearer with what we’re trying to achieve.
Click through for some functions that have been around since 2012, and others that just became available in 2022.