Random Number on SQL without using NewID()

Posted by Angel Escobedo on Stack Overflow See other posts from Stack Overflow or by Angel Escobedo
Published on 2010-02-11T20:39:40Z Indexed on 2010/03/24 5:23 UTC
Read the original article Hit count: 151

Hello I want to generate a Unique Random number with out using the follow statement :

Convert(int, (CHECKSUM(NEWID()))*100000) AS [ITEM] 

Cause when I use joins clauses on "from" it generates double registers by using NEWID()

Im using SQL Server 2000

*PD : When I use Rand() it probably repeat on probability 1 of 100000000 but this is so criticall so it have to be 0% of probability to repeat a random value generated

My Query with NewID() and result on SELECT statement is duplicated (x2) My QUery without NewID() and using Rand() on SELECT statement is single (x1) but the probability of repeat the random value generated is uncertainly but exists!


© Stack Overflow or respective owner

Related posts about sql

Related posts about random-number-generator