× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



... there is even a 4th option (except using a trigger).
... using the SQL scalar function GENERATE_UNIQUE

Generate_Unique() returns a 13 Byte Character value for bit data and does
not only include the timestamp, but generates also unique values if several
records are changed or written in the same micro second. The scalar function
TIMESTAMP will return the timestamp stored in the GENERATE_UNIQUE() value

Example:
Create Table MySchema/Mytable
(MyInt Integer,
MyUnique Char(13) for Bit Data);

Insert into MyTable
Select RRN(a), Generate_Unique()
From OtherTable a;;

Select a.*, Timestamp(MyUnique)
from Mytable a;

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"


-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von Stone, Joel
Gesendet: Tuesday, 01.5 2012 20:34
An: 'Midrange Systems Technical Discussion'
Betreff: RE: Unique ID

And option 4 is ??

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of rob@xxxxxxxxx
Sent: Tuesday, May 01, 2012 11:44 AM
To: Midrange Systems Technical Discussion
Subject: Re: Unique ID

I suggest one of four options:
1 - Using an identity column. See GENERATED at
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzhctab
l.htm
2 - Using a 'sequence'.
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzcsequ
ence.htm
3 - Using a UUID.
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/rzatk/GENUUID.
htm


Rob Berendt

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.