Subject | Re: [firebird-support] Cast( float as varchar(20) ) formatting? |
---|---|
Author | Helen Borrie |
Post date | 2010-07-09T04:16:21Z |
At 08:07 AM 9/07/2010, you wrote:
Charfield = cast(FloatField as varchar(n)) where n is the total length you want. Note, for a float type, any digits after the seventh one can be considered meaningless, anyway.
If you mean "how do you get rid of a trail of zeroes in a string", look at the string functions in the Appendix of the v.2.1 release notes. If you are using an older Firebird, look at the string functions available in the various UDF libraries around the houses.
If you are doing this conversion inside PSQL anyway, then manipulate the string in a sub-procedure.
./hb
>Hi--Once you cast a number as characters, they are not numerical any more, just a string of characters.
>
>This seems like something that should be easy
>OR I should've found easily on the group...but...Try
>
>If I:
>
>CharField = cast( FloatField as varchar(20) )
>
>I end up with:
>
>1.2345 = "1.2345000000000000"
>
>How do I format it so the trailing "0"s are NOT in the return string?
Charfield = cast(FloatField as varchar(n)) where n is the total length you want. Note, for a float type, any digits after the seventh one can be considered meaningless, anyway.
If you mean "how do you get rid of a trail of zeroes in a string", look at the string functions in the Appendix of the v.2.1 release notes. If you are using an older Firebird, look at the string functions available in the various UDF libraries around the houses.
If you are doing this conversion inside PSQL anyway, then manipulate the string in a sub-procedure.
./hb