SQL: Calculating Day of the Week Reliably in T-SQL

added by DotNetKicks
2/28/2019 2:06:03 PM

1 Kicks, 404 Views

Some T-SQL functions like DATEPART work differently based upon your session settings. If you want to write reliable code, you should always check for these issues, and try to write code that's impervious to these settings. Let's take finding the day of the week as an example.