Ah, apologies. I didn't understand what you were getting at. I see what you're saying now.
The singleton formula can be easily modified to take min/max parameters as follows using the classic domain range calculations for random numbers.
DECLARE @pMinRandom INT,
SET RandomNumber = ABS(CHECKSUM(NEWID())) %(@pMaxRandom-@pMinRandom+1) +@pMiRandom
is pronounced ree-bar and is a Modenism for R
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair
How to post code problemsHow to post performance problemsForum FAQs