Link to home
Start Free TrialLog in
Avatar of LezlyPrime
LezlyPrimeFlag for United States of America

asked on

RAND returns same dataset everytime it's run

I want to extract a random list of X number of customers every month. Here is my query:

SELECT TOP (10) Customers.Name, Customers.Address, Customers.City, Customers.State, Customers.ZipCode, RAND() AS Random
FROM Customers

Microsoft says to leave the seed blank to get a random dataset each time, but this query is getting the same dataset everytime.
ASKER CERTIFIED SOLUTION
Avatar of Ephraim Wangoya
Ephraim Wangoya
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You want to test what further ? It is also no reason to close the question after perfectly valid solutions have been given.
Microsofts own documentation says that successive calls to rand() with the same seed produces the same results.

http://msdn.microsoft.com/en-us/library/ms177610.aspx
Avatar of LezlyPrime

ASKER

Before logging off last night I ran the query without any of the RAND stuff & got the same results & thought, "I'm way off base here." I was right.

Great answers & both worked. Thanks.