Convert varying to Text

Thomas Bartmann
Thomas Bartmann Customer
Fourth Anniversary Advocate First Comment
edited January 23 in Platform

Hi All, I want to import values from a postgre database using Data Reader. However, some values are in varying format. How can I convert them to text in the Data Reader?

Tagged:

Answers

  • Samson Sunny
    Samson Sunny Employee, Community Captain
    25 Answers 100 Comments Third Anniversary 25 Likes

    Hi @Thomas Bartmann,

    Are you trying to load the varchar field column into a text cube? Usually the data reader should pick up the varchar values as text when you load into a text cube. Does it throw an error in Data Reader logs when you do this?

    Thanks,
    Samson.

  • Hi Samson, I trying to load it into entity desription and I get this error:

  • Samson Sunny
    Samson Sunny Employee, Community Captain
    25 Answers 100 Comments Third Anniversary 25 Likes
    edited January 26

    Hi Thomas,

    This error usually occurs when the server and client encoding differ, and the database driver tries to translate between those two encoding. When it cannot find an equivalent character, this error is thrown. So the server encoding and client encoding should be the same to avoid the error you see.

    Type the following commands on your database one by one to check the server and client encodings and change the client encoding from WIN1252 to UTF8:

    show server_encoding;

    show client_encoding;

    set client_encoding to 'utf8';

    If this still does not fix the issue, try changing the ODBC PostgreSQL driver to the Board Postgre driver or the PostgreSQL ODBC driver (UNICODE).

    Let me know if this fixes the issue.