|
Hi Brian, what do you mean? You want to have a column, that is automatically filled with the next numeric value, if a record is written to the file? If so, you have to define an identity column. CREATE TABLE MySchema/CUSTMASTR ( CUSTOMER_NUMBER FOR COLUMN CUSNBR INTEGER GENERATED ALWAYS AS IDENTITY ( START WITH 10 INCREMENT BY 10 NO MINVALUE NO MAXVALUE CYCLE ORDER CACHE 20 ), CUSTOMER_ADDRESS FOR COLUMN CUSADR CHAR(35) CCSID 37 NOT NULL ...) Whenever a row is inserted, the customer_number is automatically determined and inserted. This works also if a record is inserted with native I/0. Birgitta -----Ursprungliche Nachricht----- Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von brian Gesendet: Montag, 13. Juni 2005 22:58 An: rpg400-l@xxxxxxxxxxxx Betreff: status of AUTO_INCREMENT in SQL I'm trying to define my files using SQL, and immediately hitting a snag because I can't seem to define an id field with AUTO_INCREMENT like I've done a million times elsewhere. If I have to use triggers or something strange to implement this concept, could someone please get me jumpstarted with an example? Thanks. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.