Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to properly use the Decimal data type

Author  Topic 

skiabox
Posting Yak Master

169 Posts

Posted - 2008-12-17 : 04:44:13
I have created a field in a table of decimal data type using the following command :

[surface] [decimal](18, 0) NOT NULL

The problem is that whenever I enter into the cell a decimal price (for example (167,4) when I press enter I get only the integer part (167).

Any ideas how to solve this?

Thank you very much.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-17 : 04:57:20
You have set the number of decimals to ZERO!
Read Books Online about how to define precision and scale when declaring DECIMAL columns and variables.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-17 : 05:27:13
quote:
Originally posted by skiabox

I have created a field in a table of decimal data type using the following command :

[surface] [decimal](18, 0) NOT NULL

The problem is that whenever I enter into the cell a decimal price (for example (167,4) when I press enter I get only the integer part (167).

Any ideas how to solve this?

Thank you very much.


see books online about decimal and understand what precision anmd scale means

http://doc.ddart.net/mssql/sql70/de-dz_1.htm

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-17 : 06:14:42
A 30-minute echo?




E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2008-12-17 : 10:17:16
Hi,

Change Decimal size (18,1) then u get better result

Be cool....
Go to Top of Page
   

- Advertisement -