Skip to Content
0

How to convert Datatype of Primary Key Column in Hana DB

May 22, 2017 at 01:41 PM

176

avatar image
Former Member

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 ?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jin Wong
May 24, 2017 at 09:20 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded