Hi All,
What's the best way to format a number with a fixed number of decimal
places?
For instance, if I have an Amount that I want to format as dollars
and cents, I'm currently using:
begin immediate
;
create temporary table Invoice( Amount real )
;
insert into Invoice values( 123.4 )
;
select '$' || cast( Amount as integer ) || '.'
|| substr( cast( Amount * 100 + 100 as integer ), -2, 2 )
from Invoice
;
rollback
;
which gives:
$123.40
Is there a better way? I can't see any number formatting function in
SQLite's repertoire.
Thanks,
Tom
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------