Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > SQL SERVER (TECHNET) > displaying smallmoney to 2 decimal places
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 25th July 08:37
kimr&
External User
 
Posts: 1
Default displaying smallmoney to 2 decimal places



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
  Reply With Quote


  sponsored links


2 25th July 08:37
hugo kornelis
External User
 
Posts: 1
Default displaying smallmoney to 2 decimal places



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)
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666