Interview Questions   Tutorials   Discussions   Programs   

DB2 - How to insert more than one record using insert?




412
views
asked mar September 2, 2014 11:38 AM  

How to insert more than one record using insert?


           

1 Answers



 
answered By Mswami   0  
A multiple row INSERT statement with a VALUES clause.

Example:

INSERT INTO DEPARTMENT (DEPTNO, DEPTNAME, ADMRDEPT)
VALUES ('B11', 'PURCHASING', 'B01'),
      ('E41', 'DATABASE ADMINISTRATION', 'E01')

The INSERT via SELECT form is used to insert one or more rows into the table or view using values from other tables, or views, or both.

Example:

INSERT INTO T2 (intcol1,identcol2)
   SELECT intcol1, identcol2
   FROM T1 

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert