How to insert more than one record using insert?
Answers were Sorted based on User's Feedback
Answer / subi
Do an Insert using select
Insert into Table1(coltable1, coltable22)(select coltab21,
tab2col2 from Tab2 where <condn>)
Is This Answer Correct ? | 9 Yes | 2 No |
Answer / flando
Sandeep Kumar had it close. I found the answer here:
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp
?topic=/com.ibm.db2.udb.doc/admin/r0000970.htm
insert into tablename (col1, col2)
values (valu1, valu2), (valu1, valu2), (valu1, valu2)
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / harish
perform until ws-flag = 'y'
exec sql
insert into table('a','b','c','d','e')
values(a,b,c,d,e)
end-exec
evaluate sqlcode
when 000
continue
when 100
move 'y' to ws-flag
according to me ,pls let me any other remedy
Is This Answer Correct ? | 3 Yes | 2 No |
Answer / nahid gorji
using insert into table1 (column-list or *) 479 select
column-list or * from another table
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sandeep kumar
insert into tablename(col1, col2)
values(valu1, valu2)
values(valu1, valu2)
values(valu1, valu2)
values(valu1, valu2)
values(valu1, valu2)
values(valu1, valu2)
values(valu1, valu2)
values(valu1, valu2)
....................
....................
Is This Answer Correct ? | 7 Yes | 8 No |
U could probably go for a bulk insert also.
try this option
insert into schema.table1
select * from schema.table2;
Cheers,
Ratheesh Nellikal
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / kalone
If we want to insert more than 1 row into a table , we
should go for SUBQUERIES rather than VALUES clause.
Is This Answer Correct ? | 0 Yes | 1 No |
What is isolation level?
I have a subprogram B calling from mainprogram A.I have opened a cursor in A ,Can i fetch the same cursor in subprogram B , If yes , Please explain the reason?
What is a Foreign Key?
0 Answers Tavant Technologies, Zensar,
Is db2 a programming language?
What is runstats utility in db2?
What is UNION,UNION ALL?
select * from orders where odate between '2010-01-01'and '2010-03-31' How do u fetch this into cursor?
What is scrollable cursor in db2?
What is innodb buffer pool?
How to test SQL -911 error while developing COB-DB2 program
I have some 3 particular fields ..i want to know which all tables have those 3 fields. Is there any way to identify.. can we know by quering system tables..
For unmatched rows returned from an outer join, the column values in the other table are set to null e.g If A OUTER JOIN B returns some unmatched rows from A, the corresponding column values in B will be set to null. What can be done so that a null value is not displayed for these columns?