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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate Unique Serial Numbers 1

Status
Not open for further replies.

Keepontrying

Programmer
May 12, 2003
67
US
Any thought on how I can generate 100000 serial number but making sure that are all unique?

What is foxpro 8 limits on records?

Thanks
John
 
Keepontrying

FAQ184-230

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Perhaps you could use the numbers 000001 through 100000 ?


After all, "serial" numbers implies numbers following in a row.....

if you want more digits, or distinguishable series', then you could throw "extra" stuff in:

000ProdName001 through 100ProdName000
 
If the serial numbers can be alpha-numeric then something like the following would work (takes a moment to run, but not too long):

CREATE CURSOR products ( serial c(9) )
FOR i = 1 TO 100000
INSERT INTO products VALUES (substr(SYS(2015),2))
NEXT
BROWSE

...if you have a table already containing the products or whatever you are trying to assign serial numbers to then the job is even easier since you can just use a select statement on that table such as:

Select MyTable.Product, substr(SYS(2015),2) as serial From MyTable into cursor MyCursor


Slighthaze = NULL

[ul][li]FAQ184-2483
An excellent guide to getting a fast and accurate response to your questions in this forum.[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top