Wednesday, November 12, 2008

Generating random number for each line of select statement

0.SELECT CAST(CAST(newid() AS binary(4)) AS int)

1. RAND(CAST(NEWID() AS BINARY(6)))


2. SELECT rand(cast(cast(newid() as binary(4)) as int)) * cast(cast(newid() as binary(4)) as int) or SELECT cast(newid() as binary(4)) ^ cast(substring(cast(newid() as binary(4)), 7,4) as int)

No comments: