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



Birgitta

This would seem to be the same at the MI TOD value. Very nice! And to get a value to use in a file name, the HEX function would convert it nicely - have to try this immediately!!

Introduced at V5R4 for those of us who need to know! Very nice to have - did I already say very nice?!!

Vern

Birgitta Hauser wrote:
DB2 doesn't have built-in support for GUIDs yet, so you need to write your own stored procs, but that's still the right way to go if you need to uniquely identify something.

What about using the SQL Scalar function GENERATE_UNIQUE?

From the SQL Reference:
The result of the function is a unique value that includes the internal form of the Universal Time, Coordinated (UTC) and the system serial number. The result cannot be null.
This function differs from using the special register CURRENT TIMESTAMP in that a unique value is generated for each instance of the function in an SQL statement and each row of a multiple row insert statement or an insert statement with a fullselect.

... and the scalar function TIMESTAMP can be used to extract the timestamp from the generated unique value.
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 Lukas Beeler
Gesendet: Saturday, 10. April 2010 20:31
An: Midrange Systems Technical Discussion
Betreff: Re: Use sql to calculate a time difference between 2 records

On Fri, Apr 2, 2010 at 22:22, Musselman, Paul
<pmusselman@xxxxxxxxxxxxxxxx> wrote:
We had an application that time stamped all of the transactions in its
log file. But they came in so fast that multiple records had the same
time stamp! The solution was to have the application delay for a
fraction of a second between writes so the time stamps were unique.

That doesn't sound like a solution to me. More like an ugly workaround
that's going to break at some point.

DB2 doesn't have built-in support for GUIDs yet, so you need to write
your own stored procs, but that's still the right way to go if you
need to uniquely identify something.

The IBM i platform might not require a full-time DBA position, but you
still need developers that understand databases.


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.