Click here to Skip to main content
15,920,438 members
Home / Discussions / Database
   

Database

 
QuestionADO.NET and Relational Data problem.....how start? Pin
gicio2-Mar-03 10:05
gicio2-Mar-03 10:05 
AnswerRe: ADO.NET and Relational Data problem.....how start? Pin
Bernard Vander Beken5-Mar-03 9:46
Bernard Vander Beken5-Mar-03 9:46 
Generalfetching backward Pin
Hesham Amin1-Mar-03 3:42
Hesham Amin1-Mar-03 3:42 
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 
I have been looking into randomizing a result set from a SQL Server database. I have looked into using the RAND() function but there are problems with this approach because RAND() seeds every time. So a query like this, then:

SELECT ID, rand()
FROM FOO
ORDER BY 2

This outputs something similar to:

ID
-- ----
1 .754
2 .754
3 .754

Since RAND() seeds of the time and the time did not change we get the same result through the query.


There is one solution:

SELECT * FROM TABLE ORDER BY NewId()

Another thought is to use an external dll to use c++ rand()

There are other methods that generate tables of random numbers and use cursors.

My question is what method do you use?

Thanks in Advance,
John
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 
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 

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.