Solved

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

Posted on 2009-05-11
4
190 Views
Last Modified: 2012-05-06
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
Comment
Question by:SimonSaysSQL
  • 2
4 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 24356095
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
 

Author Comment

by:SimonSaysSQL
ID: 24356487
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
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 24359266
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now