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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Rand() for each row
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

215 Posts

Posted - 05/15/2011 :  08:37:45  Show Profile  Reply with Quote
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

Most Valuable Yak

15732 Posts

Posted - 05/15/2011 :  08:42:27  Show Profile  Visit robvolk's Homepage  Reply with Quote
UPDATE @Suggestions SET Priority=RAND(CAST(CAST(NEWID() AS binary(4)) AS int))
Go to Top of Page

Flowing Fount of Yak Knowledge

2875 Posts

Posted - 05/16/2011 :  08:36:54  Show Profile  Reply with Quote
Removed to right thread

Edited by - jimf on 05/16/2011 09:11:02
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000