×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




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.






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.