How to insert more than one record using insert?

Answers were Sorted based on User's Feedback



How to insert more than one record using insert? ..

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

How to insert more than one record using insert? ..

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

How to insert more than one record using insert? ..

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

How to insert more than one record using insert? ..

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

How to insert more than one record using insert? ..

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

How to insert more than one record using insert? ..

Answer / ratheesh nellikal

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

How to insert more than one record using insert? ..

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

Post New Answer

More DB2 Interview Questions

what's the equivalent Cobol Data type for Decimal(x,y) in DB2? what does the current SQLID register contain?

3 Answers   Cap Gemini, Tech Mahindra,


what is the role of the cursor in db2?

0 Answers  


What is a db2 schema?

0 Answers  


What can the SET option of the Repair Utility accomplish?

1 Answers  


How to resolve -917 sql code in DB2?

3 Answers   Cap Gemini,


What is host variable?

0 Answers  


COBOL PRECOMPILER ERROR: "XXXXXX" (TABLE) PREVIOUSLY DECLARED OR REFERENCED DCLGEN VARIABLES GETS IMPORTED TWICE FOR ONLY ONE EXEC SQL STATEMENT. WHAT COULD BE THE PROBLEM?

1 Answers  


How can we retrieve the total number of records in RPG & CLLE?

0 Answers  


What is ibm db2 connect?

0 Answers  


What are types of indexes?

0 Answers  


What are the contents of a dclmgen?

0 Answers  


For Null indicator we have 3 values 0,-1,-2. 0->Not nulll -1->Null -2->Value truncated If ther is any possibility to have any positive value other than 0 in Null indicator.If it is so then when we will get and what is the value?

1 Answers   BNP Paribas,


Categories