Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Enchance Cast() so it can format numbers
Tue, Sep 18 2012 5:41 PMPermanent Link

Barry

I'm a little surprised the Cast() function does not have any formatting capabilities for numbers like Float, Decimal, Integer etc. when converting them to a VarChar.

It is possible to use a date format or time format when casting these data types to a VarChar, but not numbers.

I'd like to be able to cast a Float or Decimal to a VarChar so it is formatted as "$123,456.0123". I should be able to specify a "$" or ",", and the number of decimal places.

Barry
Tue, Oct 9 2012 2:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Barry,

<< I'm a little surprised the Cast() function does not have any formatting
capabilities for numbers like Float, Decimal, Integer etc. when converting
them to a VarChar. >>

CAST() is simply a type-conversion function, it's not a formatting function
for end-user display/usage.  The date/time/number formatting was added
primarily to accommodate regional formatting concerns.

Tim Young
Elevate Software
www.elevatesoft.com
Image