Skip to Content

Convert varchar column to numeric (int or decimal)

Hello,

By uploading a big flat file (1.5 GB) into HANA the columns are only recognized as varchar and I don’t have the possibility to change the data type.

I've already tried this: creating a table with the correct type (currencies as decimal (17,2) and quantities as decimal (17,2). But by uploading the table, the mapping doesn’t work. The error message said that I could not map from varchar to decimal. I tried with all numeric data type and it’s not working.

The problem is that the table is quite big. I cannot open it in excel or in notepad, notepad++, etc.

Could you please tell me how I can convert the data type of columns to a numeric type (integer or decimal)?

Big thanks!


Regards

Sylvan

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 19, 2016 at 11:39 PM

    Why don't you try to put your file in the "original" table, then SELECT the data and INSERT it in the "right" table.

    When the INSERT command finish, you just drop the original table and rename the right one.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.