How to get Random emplyee no ?

Posted by Admin on 02-Jun-2008 02:19

All Replies

Posted by jtownsen on 02-Jun-2008 05:48

I assume that you haven't used every possible combination, so you're looking for only one of the valid values. One approach would be to count the number of records and then use the random function to choose a number between 1 & the number of records. You could then do FIND NEXT Employee the appropriate number of times.

Posted by Thomas Mercer-Hursh on 02-Jun-2008 10:31

There are a number of techniques which one might suggest depending on the size of the table and the purpose, e.g., do you just want one record and then you are done or are you going to end up reading a large portion of the table by the time you are done?

A little background would help frame an answer.

Also, it would help to know something about the keys. I.e., is there any structure or pattern in the keys? Are they sequential? Are there gaps? I.e., if one did have a random generator for the key space, what would that look like and how likely would it be that there would be a corresponding record.

This thread is closed