cancel
Showing results for 
Search instead for 
Did you mean: 

How to create UUID column with values when importing CSV file into HANA DB Explorer?

elinaim
Employee
Employee
0 Kudos

I'm developing a CAP Project, and I have a big CSV file.

I need an ID column as a uuid

example CSV File:
Current:

user,task,complited
user1,"finish project",1
user2,"start project",2
user3,"start project",1

Needed:

ID,user,task,complited
7e2f2630-6866-4dcf-8f4d-3027aa831234,user1,"finish project",1
7e2f2630-6866-4dcf-8f4d-3027aa831235,user2,"start project",2

I need that the import task will generate UUID column with values in order for row ID.

How can i do it from the import wizard in the HANA DB explorer?

View Entire Topic
elinaim
Employee
Employee

Thanks vitaliy.rudnytskiy

But i found a solution for this, just need to run 3 sqls after importing the DATA.

-- this table has no keys
create column table email_nokey as (
    select EMAILADDRESS, EMAIL_MIRR from "DEVDUDE"."EMAIL_ADR");    

-- add a field for the new key
alter table email_nokey add (UUID varbinary(16));

-- fill with unique values 
update email_nokey set uuid = sysuuid;

-- activate primary key constraint
alter table email_nokey add primary key (uuid);

Source: https://answers.sap.com/answers/359869/view.html