... 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

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
"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
2 - Using a 'sequence'.
3 - Using a UUID.

Rob Berendt

This thread ...


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

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