Shivendra:
 
It looks to me based on your example that you are creating a "smart field" 
where the first three chars are some sort of category and the numeric part is 
"random".  If you example is accurate then a char(3) field and a standard 
auto_increment field will do the trick.  If uniqueness is necessary use a 
composite index.
 
If a "smart field" is truly required then the trigger with hash suggestion is a 
good one, however:  
 
Suggestions to use a hash are a problem because once you have a few million 
rows the likelihood of a collision is quite high if you cannot afford an error 
stopping your application.  This means that if you write a trigger (the obvious 
way to go) you will need to trap any uniqueness violation and try again with 
different salt.  
 
Hope this helps a bit
Boyd
 
 
 
 
 







CONFIDENTIALITY NOTICE: This email & attached documents may contain 
confidential information. All information is intended only for the use of the 
named recipient. If you are not the named recipient, you are not authorized to 
read, disclose, copy, distribute or take any action in reliance on the 
information and any action other than immediate delivery to the named recipient 
is strictly prohibited. If you have received this email in error, do not read 
the information and please immediately notify sender by telephone to arrange 
for a return of the original documents. If you are the named recipient you are 
not authorized to reveal any of this information to any other unauthorized 
person. If you did not receive all pages listed or if pages are not legible, 
please immediately notify sender by phone. 





Reply via email to