SQL SERVER 2008 R2
This piece of code generates positive random integers.
declare @range bigint
SELECT name, convert(bigint,@range * RAND(CAST( NEWID() AS varbinary ))) as [Random Number]
I can't use this query within a table function
A sort of work around seems to be here.
but I am still unable to get what I want.
What I Want
To be able to use this piece of code within the table function.
convert(bigint,@range * RAND(CAST( NEWID() AS varbinary )))
i,e I want to get random number within a certain range.
my piece of code is generating only positive number, whereas I want both negative and
positive value even if I pass a positive value as a parameter
The expected result for @range=100 should be like this sort of