We store decimal (9.8) in our database. It can have any number of places after the decimal point (well, no more than 8). I'm upset because I want to display it as human-readable text, as part of a larger line created on the server. I want the number of decimal places to the right of the decimal point to be nonzero, for example:
0.05
0.12345
3.14159265
Things are good
If i do
CAST(d AS varchar(50))
I get formatting as:
0.05000000
0.12345000
3.14159265
I get similar output if I drop / convert to float or another type before casting to varchar. I know how to do a fixed number of decimal places, for example:
0.050
0.123
3.142
But that is not what I want.
Yes, I know that I can do this with complex string manipulations (REPLACE, etc.), there should be a good way to do this.