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 |
|
Heinz23
Yak Posting Veteran
84 Posts |
Posted - 2008-08-02 : 03:38:11
|
| Hi all,using the following statement works fine:Username + ' (' + CONVERT(nvarchar(10), Round(((UserValue),1)) + ')' But I always want to display 1 decimal character. It works well if there is a decimal <> 0, e.g. '5.1' and '5.2' but if the decimal is 0 it only returns '5'. How could I return '5.0'?Thanks! |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-02 : 04:51:05
|
what is the data type for UserValue ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-02 : 05:26:55
|
| make the datatype of UserValue as decimal(x,1) or Numeric(x,1) where x will be total length of characters you want it to hold. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-04 : 05:02:26
|
| As said, use decimal or numeric datatype instead of Round functionMadhivananFailing to plan is Planning to fail |
 |
|
|
Heinz23
Yak Posting Veteran
84 Posts |
Posted - 2008-08-05 : 15:53:45
|
| Hi all,UserValue is not a value stored but it's computed and I could not restrict the size at it uses rather low decimal numbers, e.g. only factor is 0.0014 which I use for multiply. It's a formula of 8-10 different elements finally resulting in a value like 32,645673. I could not modify the formula, only the output. |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2008-08-05 : 17:17:02
|
| CAST(<insert calcualtion here> AS DECIMAL(19,1)) |
 |
|
|
Heinz23
Yak Posting Veteran
84 Posts |
Posted - 2008-08-07 : 16:05:58
|
| Hi Lamprey,this works fine, thanks a lot! |
 |
|
|
|
|
|
|
|