View Single Post
  #6 (permalink)  
Old 11-05-2007, 08:38 PM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: To get random number in mysql

Quote:
Originally Posted by write2ashokkumar View Post
hi,

how to get the unique random number and random string?
For example, i start the process to insert the data into the table,with the random value, at that time i need the unique value also.... how can we get this?

Regards,
S.Ashokkumar
we have a function in Mysql UUID() [Universal Unique Identifier].

A UUID is a 128-bit number represented by a string of five hexadecimal numbers in aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee format:

* The first three numbers are generated from a timestamp.
* The fourth number preserves temporal uniqueness in case the timestamp value loses monotonicity (for example, due to daylight saving time).
* The fifth number is an IEEE 802 node number that provides spatial uniqueness

Code:
mysql> SELECT UUID();
        -> '8dcc1548-dd6d-102a-bf08-0019d123ad2a'
__________________
-Murali..
Reply With Quote