Update and Rand() Doesn't work?

Ivan Smahin ivan_smahin at paradigmasoft.com
Mon Jun 15 01:41:16 CDT 2009


Hello Antuan,

Saturday, June 13, 2009, 9:06:06 AM, you wrote:

> Is there a reason the update query doesn't work with the random
> function? Just wondering if this is a bug or not, because I'm not
> quite sure of the purpose of the Rand() function if it can't update
> as well. It works technically but it always returns the same value - that's not random.

> Update TableA Set FieldA=  RAND() 

Can not reproduce it.

CREATE TABLE t1( f1 double );

-- 100 records with 0...
INSERT INTO t1 VALUES(0);

-- RAND self
UPDATE t1 SET f1 = RAND();

-- Check all records are unique
SELECT distinct f1 FROM t1


-- 
Best regards,
Ivan Smahin 
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list