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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Random number generator

Author  Topic 

maevr
Posting Yak Master

169 Posts

Posted - 2008-12-01 : 02:56:44
I am in the need of a function that returns a list of random generated values based on the id of a primary key from a table.

The numbers are going to be used in reports that randomizes which reports that are going to be created.

Any ideas how to do this.
My first idea was to create a function that takes the min and max values as argument and returns a generateed value between these and populate a view. I encountered a problem when using the rand function inside my user-defined function.

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2008-12-01 : 03:00:29
make the column identity

Arnav
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-01 : 03:07:05
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/10/10/generating-random-numbers-part-ii.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-01 : 03:07:32
quote:
Originally posted by sunsanvin

make the column identity

Arnav
Even you learn 1%, Learn it with 100% confidence.


how would identity column return random numbers?
Go to Top of Page

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2008-12-01 : 03:11:54
sorry...
i thought of generating a serial numbered reports

Arnav
Even you learn 1%, Learn it with 100% confidence.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-01 : 03:13:02
quote:
Originally posted by sunsanvin

sorry...
i thought of generating a serial numbered reports

Arnav
Even you learn 1%, Learn it with 100% confidence.


ok...no probs
Go to Top of Page
   

- Advertisement -