|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Display numbers in a fixed format in a view
How do I use CAST (or any other function) to display a numeric value with a fixed number of characters after the decimal point? My list of values is something like this: 345.45; 3245.46578; 3422.9; 3487.344 I want to show 3 characters after the decimal point, which will result in trailing zero's being added and extra characters being rounded off. The list must look like this: 345.450; 3245.466; 3422.900; 3487.344
![]() |
|
#2
|
|||
|
|||
|
Try this : ROUND(c,decimals)
|
|
#3
|
|||
|
|||
|
thanks, I can limit the number of characters after the decimal point, but it still does not solve my 'trailing zeros' problem. Any ideas?
|
|
#4
|
|||
|
|||
|
I would suggest maybe looking into:
RPAD(columnName,5,'-') This will pad anything in your column to the right with '-' if it is shorter than 5 spaces. This is not a solution, rather you may be able to find some way to implement this. |
|
#5
|
||||
|
||||
|
Hi,
'Rpad' function is not available in SQL Server2000. Regards -Gopi |
|
#6
|
|||
|
|||
|
Thanks Gopi. My mistake.
![]() |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Display numbers in a fixed format in a view |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|