Asked by:
Randomizing Data

Question
-
User1088344998 posted
What's the best way to randomize data being passed into a SqlDataReader? The data can't be duplicated anywere.Monday, September 22, 2003 1:17 PM
All replies
-
User-2077437193 posted
Check out this SQLTeam.com article: Using NEWID to Randomly Sort Records Assuming you are using SQL Server 7.0+, you can do: SELECT * FROM TableName ORDER BY NEWID() and the results will be randomized. hthMonday, September 22, 2003 2:17 PM -
User1088344998 posted
Thanks Scott! I'll try that. JasonMonday, September 22, 2003 9:39 PM -
User1088344998 posted
That did work! Awesome!!! Thanks again Scott! I was unaware that SQL had the function! :-DMonday, September 22, 2003 9:43 PM -
User-2077437193 posted
Glad to hear it! :-) I have added a FAQ at DataWebControls.com - Returning Data in Random Order with NEWID(). Take care.Tuesday, September 23, 2003 1:51 AM -
User1088344998 posted
Thanks! I've also added a small note on my SQL Blog brought to developers by the "SqlJunkies", Donny Mack and Doug Seven. You can read about it here http://sqljunkies.com/weblog/j_gaylord/posts/229.aspx.Tuesday, September 23, 2003 11:47 AM