Randomizing Data
●
Permalink
●
suggest edit
This past week, I had an issue where I needed to randomize the data coming from SQL to use in a SqlDataReader in an ASP.NET page. I posted an issue on the ASP.NET forums and soon received help from Scott Mitchell. He pointed out that in the stored procedure I can use the code:
1
2
3
Select \*
From MyDatabase.MyTable
Order by NewID()
Of course, since Scott is the .NET Data Objects King, it worked like a charm. He received that information from http://sqlteam.com/item.asp?ItemID=8747. Thanks to Scott for the help.