SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

noamg
Posting Yak Master

Israel
215 Posts

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

USA
15676 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

jimf
Flowing Fount of Yak Knowledge

USA
2869 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  
 New 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.05 seconds. Powered By: Snitz Forums 2000