Subject Re: [ib-support] Converting DOUBLE PRECISION to VARCHAR
Author Milan Babuskov
Stephen Wood wrote:
> Hi Guys,
> I'm on a tight deadline and don't have much time to go through the archives,
> so I apologise if this questions has been asked before...
> I have a table with a double precision field called INCR_PREM_ADDITIONAL
> which holds a premium increase percentage....
> I would like to return in a SP a description field like...
> SHORT_DESCR = 'CPI Plus' || cast(INCR_PREM_ADDITIONAL as varchar(10)) || '%'
> And my output should look like "CPI plus 3.5%"...but I'm getting "CPI plus
> 3.5000000%"....
> How do I do a straight forward convert from the double precision to the
> varchar without the trailing 0's to pad the varchar?

You can try some UDF function. If you're running windows, you can use
WFORMATFLOAT from wangfunc library.


Milan Babuskov.