T-SQL 101: 75 Constructing dates and times in SQL Server using DATEFROMPARTS
I mentioned in previous T-SQL posts that one of the challenges is that there’s no standard way to write dates, so we end up having to write them as strings. Now that was a real problem in earlier versions where people would get that wrong. The DATEFROMPARTS() function added in SQL Server 2012, though, can help with this:
This query takes the year 2019, the month 2, and the day 28 and returns a date:
2020-06-22