Peter Haworth
2009-11-10 18:17:48 UTC
I have a column defined with a type of FLOAT, which I believe is
treated as REAL by SQLite. When selecting that column, I would like
it to be returned with a leading "$" sign and always have a decimal
point and two numbers after the decimal point. I can use
concatenation to get the "$" sign in there but have not been able to
enforce the inclusion of a decimal point and two decimal places.
Whole numbers are returned with no decimal point and no decimal
places. Numbers where the second decimal place would be a zero are
returned with the decimal point but only one decimal place.
I tried using the round function specifying 2 decimal places but this
does not affect the output. I have also tried using CAST to force the
column into various other types but that also does not affect the
output.
Web searches suggest that the CONVERT function is available in other
SQL implementations but I don't see that anywhere in the SQLite
documentation. Is there a way to do this or should I plan on handling
it within the application?
Thanks
Pete Haworth
treated as REAL by SQLite. When selecting that column, I would like
it to be returned with a leading "$" sign and always have a decimal
point and two numbers after the decimal point. I can use
concatenation to get the "$" sign in there but have not been able to
enforce the inclusion of a decimal point and two decimal places.
Whole numbers are returned with no decimal point and no decimal
places. Numbers where the second decimal place would be a zero are
returned with the decimal point but only one decimal place.
I tried using the round function specifying 2 decimal places but this
does not affect the output. I have also tried using CAST to force the
column into various other types but that also does not affect the
output.
Web searches suggest that the CONVERT function is available in other
SQL implementations but I don't see that anywhere in the SQLite
documentation. Is there a way to do this or should I plan on handling
it within the application?
Thanks
Pete Haworth