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 |
|
Rheinhardt
Yak Posting Veteran
66 Posts |
Posted - 2011-03-10 : 07:20:05
|
| Hi,I am doing a scenario with Item master file but don't have the Item cost prices, but I know in what bracket the item cost is so I can asume ballpark figure for the purpose of this exercise...my problem: I want to allocate RANDOM item cost prices between a certain amount (exmple: >USD20 and <USD30) to the all Items, example:ItemName,CostPrice'Itema',USD21'Itemb',USD20'Itemc',USD29'Itemd',USD30'Iteme',USD23 etc |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
Rheinhardt
Yak Posting Veteran
66 Posts |
Posted - 2011-03-10 : 07:27:31
|
| yes, but specify the number between x and y. |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2011-03-10 : 08:01:15
|
| [code]--> Usage: SELECT dbo.randomnumber (20, 25, RAND())create function randomnumber (@min bigint, @max bigint, @rand float)returns bigintasbegin return CAST(((@Max + 1) - @Min) * @Rand + @Min AS bigint)endgo[/code]- LumbagoMy blog-> http://thefirstsql.com/2011/02/07/regular-expressions-advanced-string-matching-and-new-split-function-sql-server-2008-r2/ |
 |
|
|
Rheinhardt
Yak Posting Veteran
66 Posts |
Posted - 2011-03-10 : 08:20:40
|
| thanks |
 |
|
|
|
|
|
|
|