LezlyPrime
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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/libr ary/ms1776 10.aspx
http://msdn.microsoft.com/
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.
Great answers & both worked. Thanks.