none
randomising Data in Dataset RRS feed

  • Question

  • I'm using an algorithm to assign people to a course based on a preference of 1 to 6 however i need to randomize this data to ensure the first to book don't allways get their first choise.

    Is there anyway to randomize the datarows within a dataset, or does anyone have a function to do this.

    cheers
    colin gemmmell




    Friday, June 8, 2007 10:38 AM

All replies

  • If your dataset is based on SQL Server you could try something like

     

    select * from employee order by newId()

    Friday, June 8, 2007 3:48 PM
  • Note that the above method works for SQL Server 2000 and later, but it does seem to be the most elegant way to accomplish your goal.

     

    Thanks,

     

    John (MSFT)

    Friday, June 8, 2007 9:16 PM