cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Multiple Row Insert into HANA

Former Member
19,260

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!

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 Member
0 Likes

@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 Likes

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 Likes

also not working