The first argument of DATEADD, DATEDIFF, DATEDIFF_BIG, DATEPART, and DATENAME should not produce a ColumnReferenceExpression when it's a datepart keyword (year, month, day, quarter, week, hour, minute ...
-- any SQL database (SQLite, PostgreSQL, or MS SQL Server). -- so i used MySQL syntax for the queries, but they can be easily adapted to other SQL flavors with minor changes (mostly date functions and ...