r2dbc/r2dbc-mssql

Insert multiple rows as single statement

sebastian-alfers opened this issue · 0 comments

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?