Try this on your field definition:
AUDIT_ID INT NOT NULL
GENERATED ALWAYS AS IDENTITY
( START WITH 1 INCREMENT BY 1
CYCLE)
Thanks,
Steve
Steven Bennett
Senior Systems Analyst
AIT Worldwide Logistics, Inc.
Chicago, Illinois, USA
Office: +1 (630)766-8300 / Ext: 6472
Fax: +1 (630) 250-3708
www.aitworldwide.com
our people deliver.®
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Patrik Schindler
Sent: Thursday, January 30, 2020 9:52 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Increment during insert
CAUTION: This message originated externally, please use caution when clicking on links or opening attachments!
Hello Greg,
Am 30.01.2020 um 16:16 schrieb Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>:
I need to increment a "box number" during the insert, starting at 1 and incrementing each time a value in the box ID column (BXBID#) changes.
You can define an after-insert-trigger which increments that field after insert. Also, there's a term for an mysql-like auto-increment field type, I forgot. It's allowed only once per table. Maybe someone knows what I'm talking about and can shed some light, even if this is not some RPG related question.
:wq! PoC
PGP-Key: DDD3 4ABF 6413 38DE -
https://www.pocnet.net/poc-key.asc
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-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 electronic message transmission contains information from AIT Worldwide Logistics, Inc. and is confidential
and/or legally privileged and shall remain the property of AIT Worldwide Logistics, its subsidiaries, affiliates
and parent companies. The information is intended only for the use by the designated person(s) named above. If you
are not the intended recipient, any disclosure, copying, distribution or use of or any other action or reliance based
on the contents of this information is strictly prohibited. If you received this electronic transmission in error,
please notify the sender listed above.
Global services provided by AIT Worldwide Logistics are subject to the applicable terms and conditions published at
http://www.aitworldwide.com/terms-and-conditions.
**********************************************************************************************************************
As an Amazon Associate we earn from qualifying purchases.