Skip to Content
avatar image
Former Member

want to add column in HANA Tables

Hi ,

I have created a table with few columns and loaded the data.Now I would like to add a new column and load the data to it .Could you please let me know how to do it.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 30, 2014 at 04:30 AM

    Hi Sreelatha-

    There are some posts already related to adding/removing a column . Please check before posting a new thread.

    Adding a new column:

        ALTER TABLE <tablename> ADD (<columnname> <datatype>);
    

    Example:


    ALTER TABLE emp_t ADD(emp_id nvarchar(10));


    Removing an existing column:

    ALTER TABLE <tablename> DROP (<columnname> <datatype>);
    

    Example:


    ALTER TABLE emp_t DROP(emp_id nvarchar(10));

    Thanks 😊

    Happy learning 😊

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Sreelatha-

      Yes. I did not notice when I was copy-paste. This would be correct.

      Removing an existing column:

       
       
      1. ALTER TABLE <tablename> DROP (<columnname>);

      Example:


      ALTER TABLE emp_t DROP(emp_id );

      Thanks 😊

      Happy learning 😊

  • avatar image
    Former Member
    Dec 26, 2014 at 05:11 AM

    Hi Sreelatha,

    Please read some developer guides before posting a query like this.You can make use of SQL Scripts for performing this operations.

    Please refer:UPDATE - SAP HANA SQL and System Views Reference - SAP Library

    Regards,

    Kannan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Kannan,

      This can not be done using Update statement. For adding or removing a column you need to make use of DDL statement "ALTER". "UPDATE" is a DML statement and is to update the content of the table and not the structure of the table.

      Regards,

      Piyush