Skip to Content
author's profile photo Former Member
Former Member

HANA Changing the type of a column

Hi All,

Can we change the data type of a column using any function in HANA using a calculated column...

There is a function called Date() which changes a date type of a field which is loaded from SLT into HANA(The fields loaded from SLT are by default given type as Nvarchar), but this function does not change the type of the field.

Is there a way to change the type of a field.

Thanks,

Sneha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Jul 04, 2013 at 03:16 PM

    Do you mean to alter the type in the table?

    If so, you could use the ALTER command, check the alter_column_clause:

    http://help.sap.com/hana/html/sql_alter_table.html#alter_table_alter_column_clause

    CREATE TABLE t (a INT, b INT);ALTER TABLE t ALTER (b INT DEFAULT 10);

    If, alternatively, you mean to change the type just in the view, then you can achieve that in the calculated column.

    Note that you actually define the calculated column's type, so you can have the output in any format you want.

    Best regards,

    Henrique.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 04, 2013 at 10:43 AM

    Hi Sneha,

    you can't modify the "deep" structure of a table (Names, SQL Data Types an Column Store Data Types).

    Cheers,

    Riccardo

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2013 at 02:07 PM

    Hi Sneha,

    The functions which you are referring to are the Conversion Functions that can be found under the 'Calculated Columns'.

    These functions actually create a new column in the views-NOT in the persistence layer(actual tables).

    These functions will just create a new column with the datatype you want.

    --Shreepad

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2013 at 02:19 PM

    If you wish to change the data type in the base tables, you may also go for changing the type in SAP LT configurations as well

    Refer the SAP LT configuration guides here http://help.sap.com/hana_appliance/

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 24, 2016 at 01:15 AM

    This message was moderated.

    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.