[dba-SQLServer] decimal datatype is rounding

Djabarov, Robert Robert.Djabarov at usaa.com
Fri Mar 12 11:14:35 CST 2004


How did you determine that the value stored is 2?  By running SELECT?
Is it possible that your Regional settings is doing it to you?  Also
check in Tools/Options/Connection if "Use Regional settings..." is
checked.



Robert Djabarov
SQL Server & UDB
Sr. SQL Server Administrator
Phone: (210)  913-3148
Pager: (210) 753-3148
9800 Fredericksburg Rd. San Antonio, TX  78288
www.usaa.com

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Joe
Rojas
Sent: Friday, March 12, 2004 10:39 AM
To: 'dba-sqlserver at databaseadvisors.com'
Subject: [dba-SQLServer] decimal datatype is rounding

Hi All,

I have a table with a column of data type decimal with precision set to
10
and scale set to 2.
I add records to this table using an ADO 2.7 command object.
In the command object I create a parameter with type adDecimal and set
the
Precision and NumericScale properties accordingly.
In the stored procedure I have a variable to receive the value with type
decimal.

I assign the value of 1.5 to the command object, execute the command
object
and the value that gets stored in the table is 2.

Anyone know why this rounding is taking place?

For a temporary work around, I change the data type to Money in the
table
and adCurrency in the command object.
For some reason this seems to work fine.

Thanks!
JR




This electronic transmission is strictly confidential to TNCO, Inc. and
intended solely for the addressee. It may contain information which is
covered by legal, professional, or other privileges. If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy, or take any action in reliance on this
transmission. If you have received this transmission in error, please
notify
the sender as soon as possible and destroy this message. While TNCO,
Inc.
uses virus protection, the recipient should check this email and any
attachments for the presence of viruses. TNCO, Inc. accepts no liability
for
any damage caused by any virus transmitted by this email.
_______________________________________________
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
http://www.databaseadvisors.com




More information about the dba-SQLServer mailing list