Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 Article Discussion
 Article: Using NEWID to Randomly Sort Records

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-16 : 15:42:42
We've got a quite a few articles on randomly selecting and ordering rows. I'm still amazed how popular that topic is. I recently stumbled across a post in the forums that led me to a better way to accomplish this. This has actually been posted a few times before. I'm just finally catching up.

Article Link.

karlaane
Starting Member

1 Post

Posted - 2002-10-24 : 11:58:19
Thanks for great tip, I have tried it, and;
Yes it does work in SQL 7

Karl Å. Rolfsvåg
Go to Top of Page

webq
Starting Member

1 Post

Posted - 2007-06-22 : 18:22:12
This is an old topic, but I was just revisiting it. I'm a bit of a statistician, and the data presented would not be enough to figure out how random the NEWID() function is. You would expect each number to be selected about the same frequency as all others, but if you were trying to figure out if it was random this way only, a non-random loop would appear to be random because you would end up with exactly the same frequency for each value.

You need some method of looking at the ordering of values. For example, how often a number is preceded by exactly the same the number.

www.webq.us
Go to Top of Page

binki
Starting Member

1 Post

Posted - 2014-06-18 : 14:32:53
What about the potential for completely non-random ordering as shown in http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=2242 ? Is NEWID() actually intended to be a source of randomness?

Go to Top of Page
   

- Advertisement -