Click here to Skip to main content
16,005,178 members
Home / Discussions / Database
   

Database

 
GeneralRe: fetching backward Pin
karl_w1-Mar-03 4:19
karl_w1-Mar-03 4:19 
GeneralRe: fetching backward Pin
Hesham Amin1-Mar-03 5:07
Hesham Amin1-Mar-03 5:07 
GeneralRe: fetching backward Pin
andyharman1-Mar-03 23:31
professionalandyharman1-Mar-03 23:31 
GeneralRe: fetching backward Pin
Hesham Amin2-Mar-03 11:00
Hesham Amin2-Mar-03 11:00 
GeneralRandomize SQL Result set Pin
John M. Drescher28-Feb-03 10:10
John M. Drescher28-Feb-03 10:10 
GeneralRe: Randomize SQL Result set Pin
leppie1-Mar-03 0:06
leppie1-Mar-03 0:06 
GeneralRe: Randomize SQL Result set Pin
John M. Drescher1-Mar-03 4:45
John M. Drescher1-Mar-03 4:45 
GeneralRe: Randomize SQL Result set Pin
andyharman2-Mar-03 23:59
professionalandyharman2-Mar-03 23:59 
John

I had a similar problem a couple of years back. Under certain conditions the client wanted to have rows sorted in a random order.

I wrote the following JScript ASP code:
function array_randomise() {
  var li_rnd ;
  var lo_temp ;
  //Move each record to a random position in array ...
  for (var li_loop = 0 ; li_loop < this.length ; li_loop++) {
    li_rnd = Math.round(Math.random() * li_array_len) ;
    lo_temp = this[li_rnd] ;
    this[li_rnd] = this[li_loop] ;
    this[li_loop] = lo_temp ;
  }
}

It walks through the list of records, and randomly swaps the current record with some other record (at a random position in the list).

Hope this helps.
Andy Harman
GeneralRe: Randomize SQL Result set Pin
John M. Drescher1-Mar-03 4:52
John M. Drescher1-Mar-03 4:52 
GeneralRe: Randomize SQL Result set Pin
leppie1-Mar-03 6:29
leppie1-Mar-03 6:29 
GeneralRe: Randomize SQL Result set Pin
John M. Drescher1-Mar-03 6:40
John M. Drescher1-Mar-03 6:40 
GeneralRe: Randomize SQL Result set Pin
Paul Riley1-Mar-03 7:49
Paul Riley1-Mar-03 7:49 
GeneralRe: Randomize SQL Result set Pin
Jon Hulatt2-Mar-03 23:47
Jon Hulatt2-Mar-03 23:47 
Generalconnect to access db over internet Pin
Hesham Amin28-Feb-03 1:00
Hesham Amin28-Feb-03 1:00 
GeneralRe: connect to access db over internet Pin
andyharman28-Feb-03 4:13
professionalandyharman28-Feb-03 4:13 
GeneralRe: connect to access db over internet Pin
Hesham Amin28-Feb-03 23:55
Hesham Amin28-Feb-03 23:55 
GeneralProcess Info Question Pin
Bugoy27-Feb-03 8:49
Bugoy27-Feb-03 8:49 
GeneralRe: Process Info Question Pin
andyharman27-Feb-03 9:37
professionalandyharman27-Feb-03 9:37 
GeneralRe: Process Info Question Pin
Bugoy27-Feb-03 12:27
Bugoy27-Feb-03 12:27 
Question2 sql statement using 2 command and 2 datareader? Pin
ylaine27-Feb-03 2:51
ylaine27-Feb-03 2:51 
AnswerRe: 2 sql statement using 2 command and 2 datareader? Pin
andyharman27-Feb-03 9:23
professionalandyharman27-Feb-03 9:23 
Generalsingle stored procedure Pin
ylaine28-Feb-03 5:44
ylaine28-Feb-03 5:44 
GeneralRe: single stored procedure Pin
andyharman28-Feb-03 7:22
professionalandyharman28-Feb-03 7:22 
GeneralRe: single stored procedure Pin
ylaine28-Feb-03 22:05
ylaine28-Feb-03 22:05 
GeneralRe: single stored procedure Pin
andyharman1-Mar-03 23:19
professionalandyharman1-Mar-03 23:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.