SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Two digits after decimal point
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CanadaDBA
Aged Yak Warrior

Canada
583 Posts

Posted - 04/15/2005 :  12:22:12  Show Profile  Reply with Quote
"Money" data type provides 4 digits after decimal point. I need 10 digits for integer part and only two digits as fractional part.

Canada DBA

CanadaDBA
Aged Yak Warrior

Canada
583 Posts

Posted - 04/15/2005 :  12:44:15  Show Profile  Reply with Quote
Found it: Decimal(12,2)

DECLARE @M Decimal(12,2)

SET @M = 1234567890.09

SELECT @M


Canada DBA
Go to Top of Page

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1677 Posts

Posted - 04/15/2005 :  19:58:49  Show Profile  Reply with Quote
FWIW - Every accounting package that I've worked with carries money values to at least three decimal places.

HTH

=================================================================
Every act of conscious learning requires the willingness to suffer an injury to one's self-esteem. That is why young children, before they are aware of their own self-importance, learn so easily; and why older persons, especially if vain or important, cannot learn at all. -Thomas Szasz, author, professor of psychiatry (1920- )
Go to Top of Page

robvolk
Most Valuable Yak

USA
15663 Posts

Posted - 04/15/2005 :  20:33:09  Show Profile  Visit robvolk's Homepage  Reply with Quote
If you only need to DISPLAY 2 decimal places, but not actually round off the value, then do it in your application/presentation layer, or use the CONVERT() or STR() SQL functions to convert it to a string/varchar.

You are better off using money/smallmoney rather than decimal if you're storing monetary values. As Bustaz said, you get more accuracy with money, and it's more efficiently stored and calculated than decimal types.
Go to Top of Page

CanadaDBA
Aged Yak Warrior

Canada
583 Posts

Posted - 04/20/2005 :  14:35:05  Show Profile  Reply with Quote
Thanks for posts; The request was for two digit after decimal point and only in table level.

Thanks,

Canada DBA
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000