You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When translating to tsql, the date functions are not converted correctly. For example, it translates "date_part('year', start_date)" to "EXTRACT(year FROM start_date)". But what is needed (correct) "YEAR(start_date)" or "DATEPART(year, start_date)".
Originally posted by eric-fey-hus July 4, 2023
Hi,
I want to use the transpile function to translate postgres to sql server. I am using write="tsql", but still get errors. For example, it translates "date_part('year', start_date)" to "EXTRACT(year FROM start_date)". But what I need is "YEAR(start_date)".
How can I define my own "translation" of this in a custom dialect?
Kind regards, Eric
The text was updated successfully, but these errors were encountered:
When translating to tsql, the date functions are not converted correctly. For example, it translates "date_part('year', start_date)" to "EXTRACT(year FROM start_date)". But what is needed (correct) "YEAR(start_date)" or "DATEPART(year, start_date)".
Note: EXTRACT is not valid in tsql, SQL Server: https://learn.microsoft.com/en-us/sql/t-sql/functions/date-and-time-data-types-and-functions-transact-sql?view=sql-server-ver16#GetDateandTimeParts
Discussed in #1884
Originally posted by eric-fey-hus July 4, 2023
Hi,
I want to use the transpile function to translate postgres to sql server. I am using write="tsql", but still get errors. For example, it translates "date_part('year', start_date)" to "EXTRACT(year FROM start_date)". But what I need is "YEAR(start_date)".
How can I define my own "translation" of this in a custom dialect?
Kind regards, Eric
The text was updated successfully, but these errors were encountered: