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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-05-17 : 07:21:48
|
| Amitt writes "Hi!!This is Amitt Mehrotra.I have tried your various queries for random row selection but unable to find any result.Please give me a query so that I could select 10-20 rows from a table having records more then 300000.Please note that I have a field <DIV_CODE> in that particular table in which there are 10 div_codes. I want all the 10-div_codes while selection of that particular rows.Thanking you, and with best regardsAMITT MEHROTRAIndia" |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2005-05-17 : 07:28:59
|
| select TOP 5 * from yourtable order by newid() Though I hear that this doesn't work in 2005...-------Moo. :) |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-05-17 : 07:32:10
|
| I just ran it in AdventureWorks under the April CTP, works like a charm. |
 |
|
|
|
|
|