cancel
Showing results for 
Search instead for 
Did you mean: 

Usage of sequence for uploading data into tables(column store) using CSV

Former Member
0 Kudos

How to make use of sequence when data is uploaded into table(column store) with the CSV file ?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

There is a video that explains it quite clearly

HANA Academy - Using Sequences in HANA Studio - YouTube

former_member182302
Active Contributor
0 Kudos

As you can see in the video as well, He used "Load the data from local file" option to load to the staging table and then loaded the data with sequence number with Sequence as primary key.

The only difference with my approach is, I recommended using IMPORT command to load the data into stage table and then use a Stored Procedure to load data into Final table with sequence as primary key. Advantage here is this approach can be scheduled in the background and also automated

Regards,

Krishna Tangudu

former_member182302
Active Contributor
0 Kudos

Are you trying to generate a row number?

Former Member
0 Kudos

I have defined sequence for generating values for a primary key of a table, say Employee ID or OrderID

former_member182302
Active Contributor
0 Kudos

The option i see here is, first load the flat file as-is to a stage table and then while loading to the final table you can frame ur insert statement to accomodate the sequence in it

Regards,

Krishna Tangudu

Former Member
0 Kudos

Could you please elaborate more ?

former_member182302
Active Contributor
0 Kudos

Hi Sharada,

You may have to follow the below steps:

1) To load the data from flat file to a Staging table using IMPORT command

2) You have to call the procedure to load the data further into final Table.

a) Have a look on this procedure to load data :

b) See my reply on the syntax on how to use "Sequence"

You will have to ensure that you frame your insert query in such a way to have the sequence number in the target table.

Regards,

Krishna Tangudu

Former Member
0 Kudos

please note that my requirement here is  to load data from CSV file

former_member182302
Active Contributor
0 Kudos

Yes sharada thats the reason i mentioned you to use IMPORT command to load it into Staging table first.

rama_shankar3
Active Contributor
0 Kudos

Thanks Krishna!