?
Solved

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

Posted on 2009-05-11
4
Medium Priority
?
197 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Welcome back!  My apologies for taking so long to write part two of this series; it's been a long time coming!  As I promised in Part 1, this article will focus on how to locate those elusive AD properties that you are searching for.  Why is this us…
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 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