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.
| Author |
Topic |
|
ravin4u
Starting Member
6 Posts |
Posted - 2007-10-17 : 02:30:28
|
Hii have created a quiz software in VB. i have used ini files to fetch questions.. now i have thought of changing it to SQL.. i have created a table with questionno, question, option1,option2,option3,option4 and the correctanswer.. now i want to select the questions randomly each time the question session is started.. please help me out as i need to complete this project for my school... |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-17 : 02:32:53
|
SQL Server has a Random function, so you could use that (see SQL Help file for details)Or a more cheeky method, but your Prof. may suspect you got some help!, is something like:SELECT TOP 1 questionno, question, option1, ...FROM MyTableORDER BY NewID() have a look at NewID() in the help file and you'd understand how this is working.Kristen |
 |
|
|
ravin4u
Starting Member
6 Posts |
Posted - 2007-10-17 : 02:37:18
|
thanks a lot...let me check out and come....quote: Originally posted by Kristen SQL Server has a Random function, so you could use that (see SQL Help file for details)Or a more cheeky method, but your Prof. may suspect you got some help!, is something like:SELECT TOP 1 questionno, question, option1, ...FROM MyTableORDER BY NewID() have a look at NewID() in the help file and you'd understand how this is working.Kristen
|
 |
|
|
|
|
|
|
|