Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I avoid duplicates?

Status
Not open for further replies.

bigracefan

Programmer
Apr 2, 2002
304
US
I've got an application that I use to print labels. It prints out a serial number based on max(field) + 1. If two people using the application it will give me a duplicate serial number. What is the best way to ensure that we don't get duplicates? I was thinking of putting a unique contrainst on the field and on error do a max(field) + 2, but since their are duplicates in the table now I need to flush them out. Does this sound ok or is there a better way?

Thanks
 
hi,

ummm try using RND function to generate Randon numbers to avoid duplicates.

as regards to already exisitng duplicate values u can write a select stmt to get the duplicate values and then update accordingly

hope this helps else write back

__________
[cheers]
Niraj...
"The unexpected success is not just an opportunity for innovation. It demands innovation."
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top