Skip to Content
avatar image
Former Member

How to convert Datatype of Primary Key Column in Hana DB

I have created a Table with below query.

CREATE COLUMN TABLE "packagename"."MyTable"(
"ID" NVARCHAR(10) NOT NULL,"SalesOrderNO" NVARCHAR(8),PRIMARY KEY ( "ID"
)
) UNLOAD PRIORITY 5 AUTO MERGE;

How can the primary key column be changed from NVARCHAR(10) to INT(10) datatype ?

Also how can it be set to Auto Increment everytime when a new record is created.

This table is already created in HCP Multi tenant DB, so is there a way to perform ALTER on this table columns ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 24, 2017 at 09:20 PM

    Hi MB,

    I don't think alter table supports modifying from nvarchar to int/bigint. Alternatively, create a new table, insert data from the existing one( id can be auto generated), then drop the existing table.

    Hope this helps,

    Jin

    Add comment
    10|10000 characters needed characters exceeded