cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Row Insert into HANA

I'm trying to insert more than a single row into a table I have in HANA.

insert into TABLE ("NAME", "VALUE") values ('hi', 1), ('test', 42)

... is not working.

Any workarounds to this?

Thanks!

aloba
Discoverer
0 Kudos

n Hana you can't run tow command you have to run one by one.

for example :

insert into table values ' ' first command

insert into table values ' ' second command.

Accepted Solutions (0)

Answers (2)

Answers (2)

Sefan_Linders
Product and Topic Expert
Product and Topic Expert

There is no syntax like you write it, but you could write it as following example:

create column table t1a (a integer); 

insert into t1a (
select 0 from dummy 
union 
select 1 from dummy
);

Alternatively, you can use the batch interface for JDBC, like described here: https://stackoverflow.com/questions/41677436/is-it-possible-bulk-insert-in-hana

former_member991653
Discoverer
0 Kudos

@sefan.linders2 Are there any limitations on the "insert into/select dummy/union" approach shown above in terms of number of rows or columns supported? Can anyone point me to an example that inserts at least 3 multi-column rows into a table?

The standard "insert into/values" SQL structure posted by danielbelfort has the distinct advantage of explicitly specifying which values map to which columns, which makes it less brittle in the face of multiple evolving environments.

umberto_panico
Participant
0 Kudos

Hi,

HANA does not support INSERT/UPDATE batching via a single SQL command.

Split your sintax:

INSERT INTO TABLE ("NAME", "VALUE") values ('hi', 1);

INSERT INTO TABLE ("NAME", "VALUE") values ('test', 42);

Regards.
Umberto

aloba
Discoverer
0 Kudos

also not working