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.
| Author |
Topic |
|
getur.srikanth@gmail.com
Yak Posting Veteran
77 Posts |
Posted - 2011-05-07 : 11:52:54
|
| I need to update random numbers for top 100 rows (a field) in sql. random number should be less than 100. how to do that? |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-05-07 : 12:09:03
|
| Not sure what you mean.You have a column called [top 100 rows] which you want updated with a random number?You want a column updated on the the top 100 rows - in which case you need to say what you mean by te top 100?You want the numbers 1 - 100 randomly allocated to a column?==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
getur.srikanth@gmail.com
Yak Posting Veteran
77 Posts |
Posted - 2011-05-07 : 12:28:05
|
| I got answer my self.update tablename set fieldname = cast(cast(crypt_gen_random(1) as int) * 100.0 / 256 as int) |
 |
|
|
|
|
|