|
Bonjour Richard, This is almost perfect: on V5R2, ROWID generates a 40-character variable-length field with an allocated length of 26. Unfortunately, it takes up a lot of space, and I'll be dealing with a large number of records...and using a literal is harder than usual. Thanks, Reeve > -----Original Message----- > From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l- > bounces@xxxxxxxxxxxx] On Behalf Of Richard Theis > Sent: Tuesday, July 13, 2004 3:36 AM > To: midrange-l@xxxxxxxxxxxx > Subject: RE: Fastest way to get a unique identifier/tracking column > changes > > > > > > > Reeve wrote: > > I though the "IDENTITY" value was table-specific, not global. > Therefore, > to > > track changes from multiple tables in one "historical tracking" table, > I'd > > need to identify each tracking record by table and identity value. > > Check the SQL type ROWID, it is unique across all DB2 UDB for > iSeries/zSeries . > > >From Information Center: > > A row ID is a value that uniquely identifies a row in a table. A column or > a host variable can have a row ID data type. A ROWID column enables > queries > to be written that navigate directly to a row in the table. Each value in a > ROWID column must be unique. The database manager maintains the > values > permanently, even across table reorganizations. When a row is inserted > into > the table, the database manager generates a value for the ROWID > column > unless one is supplied. If a value is supplied, it must be a valid row ID > value that was previously generated by either DB2 UDB for OS/390 and > z/OS > or DB2 UDB for iSeries. The internal representation of a row ID value is > transparent to the user. The value is never subject to CCSID conversion > because it is considered to contain BIT data. The length attribute of a > ROWID column is 40. > Using ROWID is another way to have the system assign a unique value to > a > column in a table. ROWID is similar to identity columns, but rather than > being an attribute of a numeric column, it is a separate data type. To > create a table similar to the identity column example: > > > CREATE TABLE ORDERS > (ORDERNO ROWID > GENERATED ALWAYS, > SHIPPED_TO VARCHAR (36) , > ORDER_DATE DATE) > > > > Bonne réception/Best regards > Richard THEIS > Education iSeries 400, Sce 8075, MTG > 01.49.14.46.34 / Fax 01.43.04.59.85 > theis_richard@xxxxxxxxxx > > > -- > 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: http://lists.midrange.com/mailman/listinfo/midrange-l > or email: MIDRANGE-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.