cancel
Showing results for 
Search instead for 
Did you mean: 

How to change decimal point seperator for csv import

Former Member
0 Kudos

Hi HANA-Experts,


I would like to import csv-files in which a comma is used as decimal point seperator.

Per Default HANA expects a dot. Can you please tell me how to change the data format?

I know that I can change the seperator in the source file, but that's not the solution I'm looking for!

Thanks for your help!

Isabell

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Hi Isabell,

currently there is no way to do that for the IMPORT/IMPORT FROM statements.

Either you use a proper data loading tools like SAP DataServices or you prepare the import file so that the decimal separator is a dot.

- Lars

Former Member
0 Kudos

Hi Lars,


ok, that's too bad. I'm usually working with SAP BW....there you can define the seperator very easily.

Thanks for your answer.

Isabell

lbreddemann
Active Contributor
0 Kudos

Well, SAP HANA is not meant to replace a full blown dataware housing suite like SAP BW.

In fact the data provisioning options are provided in SAP DataServices, SAP SLT, Smart Data Access ...

All these tools are part of the SAP HANA solution space - but not built-in to SAP HANA:

- Lars

Former Member
0 Kudos

Hi all,

as there's already the possibility to change the time-format during imports, I'm looking forward having the possibility to specify the number formats as well.

Meanwhile, here's a workaround which could be applicable for certain scenarios.

Best regards,

Til

DROP TABLE T;

--import your values including comma

CREATE TABLE T (KEY INT PRIMARY KEY, VAL NVARCHAR(20));

INSERT INTO T VALUES (1, '1,2');

INSERT INTO T VALUES (2, '2,3');

-- add a decimal-column

ALTER TABLE T ADD (VAL_DEC DECIMAL(17,2));

-- copy the "comma-column" to the new decimal-column

UPDATE T SET VAL_DEC = replace(VAL, ',','.');

-- get rid of the comma-column and rename the decimal-column appropriately

ALTER TABLE T DROP (VAL);

RENAME COLUMN T.VAL_DEC to VAL;

select * from T;

Answers (0)