Support 3 parameter datepart in SQL

0 Kudos

The DatePart function allows 3 parameters when used in the DSS engine.  The third parameter is the timezone from which you want the value to be reported (example, if I want the "Hour" value of a date time, but I need it in "US Mountain Time Zone" rather than in UTC).

When calling this function as part of a recipe that must run with the SQL engine, the system reports an error: Recipe cannot be translated to SQL: Wrong number of arguments given to SQL function DATEPART: 3

It is possible to implement this because MSSQL supports this with the following syntax:

datePart(hour, <time column name> AT TIME ZONE 'US Mountain Standard Time')