Forum Discussion
ODBC error 22007 with Pervasive SQL: Date/time data issue
I know this post is old, but I was having this same issue for over a year and couldn't find a solution until today.
I know this works when you IMPORT, I do not know if it works with Direct Query.
1 - Install the Maria ODBC Connector.
2 - Press Start, look for ODBC Data Sources in Administrative Tools.
3 - Add a new User DSN and input all the details needed. Should look something like this:
4 - Go to Power BI and Click Get Data. Select Blank Query. The function we will use is Odbc.Query where the first part is the connection string and the second one is the query. What I found out is that if you change the name and the type of the column inside that query you will stop getting the data type error. The table I had the error was "sd_atividade_chamado" and it was setting the data type before I could do anything. The query will be something like:
Odbc.Query(,"SELECT
CAST(cd_chamado AS CHAR) AS cd_chamado_texto,
CAST(cd_atividade_chamado AS CHAR) AS cd_atividade_chamado_texto,
CAST(cd_atendente AS CHAR) AS cd_atendente_texto,
CAST(cd_atendente_chamado AS CHAR) AS cd_atendente_chamado_texto
FROM sd_atividade_chamado")
5- Profit...... From there you can work however you want.
Hope this can help someone because I had a project on hold for over a year over this...