When working with dates in SQL Server, sometimes you might find yourself reaching for the DATEPART()
function, only to realise that what you really need is the DATENAME()
function. Then there may be other situations where DATEPART()
is actually preferable to DATENAME()
.
So what’s the difference between the DATEPART()
 and DATENAME()
 functions?
Let’s find out.