yep - pray I am NOT! 😱😱😱😱

On Wed, Dec 12, 2018 at 3:15 PM Rob Berendt <rob@xxxxxxxxx> wrote:

Dave,
I wondered about that.
Hopefully he's not uploading a bunch of daily batches. You know the ones
where it starts over with a new identity column of 1 every day and when
you insert that into the upload it hurls because 1 is already in use
(assuming the identity column is also a primary key constraint).


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: dlclark@xxxxxxxxxxxxxxxx
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Date: 12/12/2018 03:12 PM
Subject: Re: sql insert (ignore auto generated ID)
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 12/12/2018
02:31:45 PM:
i have a statement

insert into ldatat3x.ftpdtl
(select *
from ldatad3x.ftpdtl
where dftpid = 'PMIISGN-G')

source and target file are same of course except in different libs...
primary key on both is ID which is auto generated.

to avoid, Value cannot be specified for GENERATED ALWAYS column DID., i
know I can layout the source/target columns, but what a PIA.
is there an easy way to simply ignore/override the ID column and have
sql,
be smart enough to assign a new one from the target table/rows?

I've tried the following with no luck...

insert into ldatat3x.ftpdtl overriding system value
(select *
from ldatad3x.ftpdtl
where dftpid = 'PMIISGN-G')


That is example what IBM says. So, what do you mean by "no luck"?

<quote>
You can force the system to use the value from the select for a GENERATED
ALWAYS identity column by specifying OVERRIDING SYSTEM VALUE. For example,

issue the following statement:

INSERT INTO ORDERS OVERRIDING SYSTEM VALUE
(SELECT * FROM TODAYS_ORDER)

This INSERT statement uses the value from SELECT; it does not generate a
new value for the identity column. You cannot provide a value for an
identity column created using GENERATED ALWAYS without using the
OVERRIDING SYSTEM VALUE clause.
</quote>


Sincerely,

Dave Clark
--
int.ext: 91078
direct: (937) 531-6378
home: (937) 751-3300

Winsupply Group Services
3110 Kettering Boulevard
Dayton, Ohio 45439 USA
(937) 294-5331





*********************************************************************************************
This email message and any attachments is for use only by the named
addressee(s) and may contain confidential, privileged and/or proprietary
information. If you have received this message in error, please
immediately notify the sender and delete and destroy the message and all
copies. All unauthorized direct or indirect use or disclosure of this
message is strictly prohibited. No right to confidentiality or privilege
is waived or lost by any error in transmission.

*********************************************************************************************
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.