View previous topic :: View next topic
|
Author |
Message |
Deja vu
New User
Joined: 15 Oct 2009 Posts: 23 Location: Pune
|
|
|
|
Hi All,
I have to Insert several row into a table as described below but
I dont want to use 100s of queries, how can I get this result in one insert sql?
INSERT INTO TABLE1
(
Col1,
Col2,
Col3,
...)
VALUES(
A1,B,C)
I have to insert 100 rows, B C remains constant for all the rows but A1 keep changing from A1 to A100.
example-
A1,B,C
A2,B,C
A3,B,C
.....
.....
A100,B,C
Thank you! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Then put the data into a file and load it. . . |
|
Back to top |
|
|
Raghu navaikulam
Active User
Joined: 27 Sep 2008 Posts: 193 Location: chennai
|
|
|
|
Hi Deja
If you are using a program to insert 100 rows using a single INSERT query, then it is possible. In which way you want to execute-SPUFI/QMF/Program ?
Regards
Raghu |
|
Back to top |
|
|
Deja vu
New User
Joined: 15 Oct 2009 Posts: 23 Location: Pune
|
|
|
|
Hi,
I'll test in SPUFi but in production I'll write a query job under IKJEFT01 as don't have update access on production.
Thanks!
Raghu navaikulam wrote: |
Hi Deja
If you are using a program to insert 100 rows using a single INSERT query, then it is possible. In which way you want to execute-SPUFI/QMF/Program ?
Regards
Raghu |
|
|
Back to top |
|
|
Raghu navaikulam
Active User
Joined: 27 Sep 2008 Posts: 193 Location: chennai
|
|
|
|
Hi
In SPUFI/QMF and in JCL using IKJEFT01 using SQL as input, I think it is not possible. As per my knowledge using an INSERT query one can insert only one row at a time using SPUFI/QMF/IKJEFT01. Some one will help you in this regard.
Regards
Raghu |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest concentrating on getting the job done rather than trying to make some particular "solution" fit. . .
To repeat:
Quote: |
Then put the data into a file and load it. . . |
Why would a multiple insert query be preferred over the load? |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
you'll need a table with at least 100 rows and a column to sort it on(I'll use sysibm.systables and obid as an example)
Code: |
insert into T1
select 'A' !! char(row_number() over (order by obid))
,'B','C'
from sysibm.systables
fetch first 100 rows only |
|
|
Back to top |
|
|
|