MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multi Row Insert via QMF

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
cyberuser
Beginner


Joined: 15 Oct 2005
Posts: 29
Topics: 12

PostPosted: Mon Jul 06, 2009 9:39 pm    Post subject: Multi Row Insert via QMF Reply with quote

i tried to use the following statement on qmf and it worked fine.
INSERT INTO table (name, address)
values ('john doe', 'street one')

but when using :
INSERT INTO table (name, address)
values ('john doe', 'street one'),
values ('mary doe', 'street two')
i
t didn't work... Any suggested workaround to include multiples recs into the table?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Jul 06, 2009 9:58 pm    Post subject: Reply with quote

cyberuser,

Try this untested sql

Code:

INSERT INTO Table (name, address) FOR 2 ROWS
VALUES ('john doe', 'street one' ,'mary doe', 'street two')
ATOMIC;
Back to top
View user's profile Send private message Send e-mail Visit poster's website
cyberuser
Beginner


Joined: 15 Oct 2005
Posts: 29
Topics: 12

PostPosted: Mon Jul 06, 2009 10:14 pm    Post subject: Reply with quote

it seems it's not recognizing the "2" .... from statement FOR 2 ROWS...
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Tue Jul 07, 2009 2:44 am    Post subject: Reply with quote

Quote:
it didn't work
is crap. try providing sqlcode next time with dsntair output

newer versions of db2 allow for multiple VALUES but the syntax is with only one VALUES phrase. look-up the syntax, I know the manual provides an example.

if you are on an older version of db2, try using UNION:

INSERT INTO Table (name, address)
values (jdjdj,djdjdj)
UNION
<work out what you have to do here>

and it is ROWS not records. and stop abbreviating, this is not a chat room.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group