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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help needed for selecting random no's

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-07 : 09:08:57
Heljeeve writes "I am using sql server 7.0.
-------------------------


Using Stored procedures i need random no's between some range of no's


say

SELECT StartRange,EndRange FROM Purchased WHERE SUBSTRING(Lot_Idx,1,5)='L0177'

the rowcount will be dynamic (may be 3,4,5,10 etc)


1, between 10000 and 10100
2, between 10500 and 10699
3, between 00500 and 01699


the procedure should select randomly these rows(range of no's)
and from with in this range, randomly should select some no's

say from 10000 to 10100


the total no of randomly selected no's also should be dynamic

say i need 5,20,100 etc.. random no's from all these above ranges


and the selected no. should not be repeated also

Without using temporary tables,and no's should be in a ouput parameter"

andre
Constraint Violating Yak Guru

259 Posts

Posted - 2002-03-07 : 09:53:25
These articles should get you started:
[url]http://www.sqlteam.com/FilterTopics.asp?TopicID=135[/url]

Go to Top of Page
   

- Advertisement -