cancel
Showing results for 
Search instead for 
Did you mean: 

How to Import data from a CSV file available in Data base to HANA table with HANA procedure

Former Member
0 Kudos

Hi All,

I have a requirement to read a data from a CSV file which is place in Data base and store in HANA table. After reading multiple blogs I came to know we can use Import statement.

But I am getting Error: feature 'ImportExport.Import' is disabled. So I tried to modify the Configuration with the help of ALTER Configuration command but did not worked. It gave error general error: change not allowed for tenant database

I am trying this on Trail MDC Database.

Please find the Code Snippet and let me know is there any solution for this.

CREATE PROCEDURE "TRAIL"."Test3"() LANGUAGE SQLSCRIPT AS BEGIN EXEC 'IMPORT FROM CSV FILE ''C:/Users/Desktop/zone1.csv'' INTO "EMPLOYEEINFO" WITH RECORD DELIMITED BY ''\n'' FIELD DELIMITED BY '','''; END

and with Control file:

CREATE PROCEDURE "SYSTEM"."Trail::Home1" ( ) LANGUAGE SQLSCRIPT AS BEGIN EXEC 'ALTER SYSTEM ALTER CONFIGURATION (''indexserver.ini'', ''SYSTEM'') set (''import_export'', ''enable_csv_import_path_filter'') = ''true'' with reconfigure' ; EXEC 'ALTER SYSTEM ALTER CONFIGURATION (''indexserver.ini'', ''SYSTEM'') set (''import_export'', ''csv_import_path_filter'') = ''/'' with reconfigure'; EXEC 'IMPORT ''data.ctl'''; END

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member540015
Participant
0 Kudos

IMPORT FROM CSV FILE

SQL commands is for local files only, this means your CSV file has to be on the host HANA's machine, more strictly in a specific working folders of $DIR_INSTANCE. If you are able to upload your CSV onto HANA host, then you may need to add your "C:/Users/Desktop" folder into:

SET ('import_export', 'csv_import_path_filter') =

OR disable filtering:

SET ('import_export', 'enable_csv_import_path_filter') = 'false'

More info is here Import CSV into SAP HANA, express edition using IMPORT FROM SQL command

I don't know either if dynamic SQL is accepted in

CREATE PROCEDURE