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 |
|
technicalsachin
Starting Member
1 Post |
Posted - 2005-07-04 : 00:31:38
|
will u plz suggest me the way to randomize rows in a table.i just want random images to display on a web page. |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-07-04 : 00:42:03
|
| ORDER BY NEWID()MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2005-07-04 : 00:42:25
|
| Have you looked at the RAND function?select MyImagefrom MyTablewhere ImageID = cast((Rand() * <Number of Images> as Int) + 1Assumes that the images arenumbered 1 through <Number of Images>HTH================================================================='Tis with our judgements as our watches: none Go just alike, yet each believes his own. -Alexander Pope, poet (1688-1744) |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2005-07-04 : 06:55:01
|
| Rand() is not unique for every record, in a resultset....newid() is.TrySelect *, rand() from yourtable....and inspect the rand values...and then compare to select *, newid() from yourtable |
 |
|
|
|
|
|