insert multiple rows into DB2 database

前端 未结 5 568
野趣味
野趣味 2020-12-05 04:20

I want to insert multiple rows into a DB2 table. I have a query that looks like this

insert into tableName 
(col1, col2, col3, col4, col5) 
values 
(val1, va         


        
5条回答
  •  囚心锁ツ
    2020-12-05 05:16

    None of the above worked for me, the only one working was

    insert into tableName  
    select 11, 'BALOO' from sysibm.sysdummy1 union all
    select 22, nullif('','') AS nullColumn from sysibm.sysdummy1
    

    The nullif is used since it is not possible to pass null in the select statement otherwise.

提交回复
热议问题