Skip to content

Insert multiple rows as single statement #282

@sebastian-alfers

Description

@sebastian-alfers

I am trying to insert something like this:

insert into table(id, db_timestamp) values (1, SYSDATETIME()), (2,SYSDATETIME());

Looking at the two rows, they have the same timestamp. When I do the same in code, the timestamps are different:

val insertSql = "insert into table(id, db_timestamp) values(@id, SYSDATETIME())"
connection
     .createStatement(insertSql)
     .bind("@id", 1).add()
     .bind("@id", 2).add()
     .execute()

Is it possible that the code above creates two separate statements, instead of combining them into a single insert with multiples values?

Any idea how to achieve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: stackoverflowA question that is better suited to stackoverflow.comstatus: waiting-for-feedbackWe need additional information before we can continue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions