Forum Discussion
How to prevent automatic datatype conversion with database connection
I forgot to mention that I'm simply trying to get it to import as text. The underlying data is a duration but I'm transforming the data to extract days. The data transformation used to work perfectly before it decided to start converting the data to time format.
ChrisMajestic wrote:
I forgot to mention that I'm simply trying to get it to import as text. The underlying data is a duration
Then you have to add a step doing an explicit cast or conversion to text. Otherwise Power BI will attempt to use the closest compatible data type.
- ChrisMajestic2 years agoFrequent Visitor
I tried that but converting it to text doesn't revert the numbers back what they were prior to the transformation. In other words the previous number was 20:21:34 which it converted to 8:21:34 pm. So when I try to convert it to text it keeps it as 8:21:34 pm in text form instead of 20:21:34.
- d_gosbell2 years agoSuper User
So this could also be an issue with type conversion in the ODBC driver. You could try doing the conversion to a string explcitly in a view or SQL query so that it's done by the source database engine.
- ChrisMajestic2 years agoFrequent Visitor
Sounds interesting. How do I do that?