|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
generate_unique
has any one tried UDB V8 (windows) function
generate_unique() and had any issues with it? thanks, fv
__________________
...because that is the way we have always done it. We've been doing it like that for 80 Years! (How do we change that mindset?) |
|
#2
|
||||
|
||||
|
I have never used it in any of my tables so I'm not sure if there are any issues to worry about. The only thing I can think of is Windows boxes have an option to automatically adjust the time for Daylight Savings Time. The generate_unique() function uses the internal clock to create an ever increasing bit value based on the time. Adjusting the time on your machine backwards can create duplicate values.
Does generate_unique() have the ability to ignore the clock jumping backwards each year? Does it create its value off of the base time ignoring the one hour tweaks twice a year? You would hope they would be smart enough to program it that way. Otherwise, for one hour a year when the clocks fell back, you could run the risk of a duplicate value. Of course this point would be moot if your Windows box was set to UTC or to ignore Daylight Savings Time. My gut feeling is that the function probably uses a base time and ignores any time zone or DST settings that have been applied to it. If that is true then the only caveat would be: Don't ever adjust the time on your machine backwards. |
|
#3
|
|||
|
|||
|
Thanks for the input - a little more investigation:
http://www-106.ibm.com/developerworks/db2/library/techarticle/0205pilaka/0205pilaka2.html#section2 yields this snippet of info: Another point to keep in mind is that since the timestamp value created from the GENERATE_UNIQUE function is obtained from the system clock, adjustments to the system clock backward could result in duplicate values. Basically I have to generate a unique confirmation number for clients. The system is a web (ASP/DB2) based app that mostly uses Z/OS tables. The confirmation # must be in an Z/OS table ultimately. My choices are: 1 Z/OS - a table that is just used for its identity value (dumb) 2.) UDB (Windows) use a Sequence object and then store that in Z/OS 3.) generate_unique(windows) and do the same as 2. So far #2 looks like the best idea. The only way to do natively in Z/OS would be a table with maybe 2 columns, and identity value ID that is generated and some other column, maybe a timestamp so I could do an insert and get the ID value with identity_val function. #2 would work without any actual table activity. Still Thinking... thanks, fv |
![]() |
| Viewing: Dev Shed Forums > Databases > DB2 Development > generate_unique |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|