Re: displaying smallmoney to 2 decimal places

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Fri, 28 Oct 2005 18:05:01 -0700, Kim wrote:

>Heres an example of a query with the display
>
>SELECT * FROM STOCKks WHERE Price < Cost; Both price and cost are
>smallmoney datatypes. They display with 4 digits to the left of decimal pt.
>How do I set it to display only 2 digits for both colums?
>
>THanks, Kim

Hi Kim,

The best advise is to:
a) do formatting in the front end, not at the server, and
b) avoid the use of money and smallmoney datatype, becuase they are
proprietary and non-portable AND because they suffer from some strange
rounding issues. Use DECIMAL (17,2) instead.

If you must use money and must do the formatting at the server, then
SELECT CAST (Price AS DECIMAL(17,2))
will work.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.



Relevant Pages

  • Re: Labor Day in Tx...
    ... anytime, or just send the money to kw@xxxxxxxxxxx ... Maybe...It's just that my screen won't display more than 8 digits to the ...
    (rec.motorcycles.dirt)
  • Re: Cobol Myth Busters
    ... than just TRUNC (wich has 3 flavors on IBM zSeries). ... using 18 digits: packed decimal is 74% faster than binary ... packed decimal is 60% slower than binary ... DISPLAY compared to packed decimal ...
    (comp.lang.cobol)
  • Re: FPGA Journal Article
    ... 10 decimal digits fixed-point display, ... Above 1 MHz limited by time base accuracy, below 1 MHz by display ... but clutter up the design. ... A 20 times more accurate time base would cost <$20 extra. ...
    (comp.arch.fpga)
  • Re: Price Data Formatting
    ... When you load in a datafile of a stock or commodity, ... only 3 digits following the decimal rather than 4. ... So when I display prices in my application, I want to use the SAME format as ... It doesn't fit well in my textboxes for display. ...
    (microsoft.public.vb.general.discussion)
  • Re: Bally 14 digit display repair (Atlantis and others) 6803 game
    ... Perhaps one of the digit driver transistors are blown. ... The bad thing about these is the you will have to bend the display down in ... The Millions place has all segments lit all the time. ... a couple other segments on other digits that do not light up as well. ...
    (rec.games.pinball)