Subject RE: [firebird-support] How to cast a float?
Author Alan McDonald
> >
> > select cast(depreciation_rate as integer) || '%' from my_table
>
>
> Try
> select cast(depreciation_rate as varchar(10)) || '%' from my_table
>
> I tried it on a couple of fields in one of my db's and got the same error
> because I had not casted to a long enough variable. Made it longer (
> VarChar(10) ) and it worked.
>
> Lee
this will work were the float naturally finishes at 10 places for the float
but you will get the error again when the sig places of the float extends to
more than 10 places.. (earlier in fact)
You'd best cast it as a numeric 8,3 first or use a UDF to return a two place
decimal as a string.
Alan