The CreateUUID() might be usefull if you don't need it to be an int.
Otherwise I would create an other table to produce your key
like ...
[index_table][key]
/ \
/ \
[table1][key] [table2][key]
WG
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 20 March 2003 17:56
To: CF-Talk
Subject: Unique random number?
Need to set a job number to a unique number, based of creating a number
using the RandRange function, but then I need to take that number and
bounce it off two access tables (called openjobs & closejobs) to see if
that random number is already used, then loop back if it is to start over,
but if it isn't, then use it to create a new record in openjobs table.
What I don't know how to do is the loop structure if the number already
exists on one of the two tables.
Could someone direct me in how the code would look starting with this CFSET
statement?
<CFSET job_number = RandRange(1, 100000)>
...and as always, thanks in advance!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4