Skip to Content

How to change VARCHAR to INT using calculated column.

I have a VARCHAR column in a table having only numbers and Blank spaces. I need to convert this column as Integer, but the problem I am facing is with the Blank Space. I need to convert that to NULL, which I am not able to do. I can't alter the table as well.

I am running HANA SPS 12.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 06, 2017 at 01:44 PM

    You can use following to convert your values to an Integer and blank values to a Null value.

    if(trim("COLUMN") = '', NULL, int("COLUMN"))

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded