• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

VBScript should generater random names but it selects the same peole each time

Hello, the attached vbscript is supposed to generate a random selection of names each time. Instead it is selecting the same names.

Thank you for your help.

Wendy
code-Random.txt
0
SimonSaysSQL
Asked:
SimonSaysSQL
  • 2
1 Solution
 
SStoryCommented:
I see nothing in your solution that would make anything random.  It goes to a table and gets data.  The data is the same.  You should either write a stored procedure if this is SQL Server that gets a random number of rows, or if the list isn't very long, you could get all of rows and use the basic RND function to choose random numbers and get those elements of the local collection or array where you stored the incoming rows.
0
 
SimonSaysSQLAuthor Commented:
S Story,
You are correct It is pulling data from a View. Apparently when you run the View in a Query it works and gives random data but when it is run with this code it keeps giving the same names.
I just found this out or I would have included it in the original message.
Thanks.
 
0
 
SStoryCommented:
Well your code just says get the top x results from that table or view. That will always get the same top x results unless there is some radomizing code in the view because the CODE you showed doesn't randomize.  I think a stored procedure that can be called that does the randomization might be better.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now