generating a random number 
Author Message
 generating a random number
I'm using SS2000 and I want to generate a random number for each row in a
table. I created a table and made the seq_num column an identity column.
Then I inserted the rows. Then I used the following statement to create a
random number:

update tblCFICombined1 Set Random_ID = rand() * SEQ_NUM

When I select the seq_num and random_id and order by the random_id, the
order of the random_id and the seq_num are the same.

What am I doing wrong?



Sun, 23 Apr 2006 22:14:49 GMT
 generating a random number

If you are using win 2000 or later, use newid() function to select random

select top 10 orderID from orders order by newid()


Sun, 23 Apr 2006 22:27:30 GMT
 generating a random number
Shuffle it well!


                            DATEPART(ms, CURRENT_TIMESTAMP) + seq_num)

- Anith
( Please reply to newsgroups only )

Sun, 23 Apr 2006 22:47:53 GMT
 [ 3 post ] 

 Relevant Pages 

1. generating a random number with duplicate records

2. Generating a random number

3. PL/SQL Generating a random number

4. How do I generate a random number in VB ?

5. How to generate a random number at pl/sql ?

6. EASY: SQL to generate a simple random number?

7. How to generate random numbers!

8. Generating Random Numbers

9. Generating Random Numbers

10. Generating random numbers mixed with strings

11. How to generate a difficult random number.

12. need help - generating random numbers

Powered by phpBB® Forum Software