MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » December 2012

RE: Another SQL Question



fixed

Did you mean withOUT naming all of the fields?

Sure you can!

Will this work?


CPYF FROMFILE(*LIBL/myFile) TOFILE(QTEMP/myFile) FROMRCD(1) MBROPT(*REPLACE) CRTFILE(*YES)

Runsql 'UPDATE qtemp/myfile set company# = ''2'''

CPYF FROMFILE(QTEMP/myFile) TOFILE(*LIBL/myFile) FROMRCD(1) MBROPT(*add)

Should do the trick.




-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of JackTucky
Sent: Wednesday, December 05, 2012 12:50 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: Another SQL Question

Yes. I thought I could get away with naming all of the fields.

Thanks

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: Wednesday, December 05, 2012 1:39 PM
To: Midrange Systems Technical Discussion
Subject: Re: Another SQL Question

You mean like
INSERT INTO MYTABLE
(select 2, colb, colc, cold, cole, colf, colg from mytable)


Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





From: "JackTucky" <jacktucky@xxxxxxxxx>
To: <midrange-l@xxxxxxxxxxxx>,
Date: 12/05/2012 01:26 PM
Subject: Another SQL Question
Sent by: midrange-l-bounces@xxxxxxxxxxxx



I have several different files that all contain a company#. I want to use
SQL to write a new record for every record in the file but change the
company number to 2. All of the other fields remain the same.



I know it's possible but I'm having a hard time googling. I'm guessing
I
need an insert into with another select?



Thanks, Jack.










Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact