Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Rand() for each row

Author  Topic 

noamg
Posting Yak Master

215 Posts

Posted - 2011-05-15 : 08:37:45
hi,
I need a float column with a new rand value for each row.
But I get the same value to all rows !?

UPDATE @Suggestions SET Priority = rand()
what to do ?


Noam Graizer

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-05-15 : 08:42:27
UPDATE @Suggestions SET Priority=RAND(CAST(CAST(NEWID() AS binary(4)) AS int))
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2011-05-16 : 08:36:54
Removed to right thread
Go to Top of Page
   

- Advertisement -