Re: Decimal Data Type losing scale?

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

From: Aaron Weiker (aaron_at_sqlprogrammer.org)
Date: 01/31/05


Date: Mon, 31 Jan 2005 14:50:27 -0800

Hello Q,
When you run profiler what do you see the values being sent as? If you have
your precision and scale not matching exactly in your VB.NET application
it can cause it to send it incorrectly to the database.

--
Aaron Weiker
http://aaronweiker.com/
http://sqlprogrammer.org/
> I'm trying to update a table that has decimal values.  They are
> defined at precision of 15 and scale of 2.
> 
> When I use a T-Sql update query, I'm sending a value "with pennies",
> but the
> table is only reflecting the integer portion.  I've even tried
> UPDATE (myTableName)
> SET myCost = CAST(@Cost AS decimal(15,2))
> without success.
> When I step through the code of my VB.NET program and view the value
> of item I've added to the parameters collection of my update query
> command object, I DO SEE the pennies.  When the query has executed,
> they aren't in the table.  I CAN TYPE the pennies into the record in
> the table with Enterprise Mgr.  And I can retrieve them with my
> program.  But I can't send new values with pennies and get them
> respected in the new table values.
> 
> I have seen in Books on Line that we are supposed to explicitly CAST
> our decimal values.  But shouldn't this take care of it?
> 


Relevant Pages

  • Decimal Data Type losing scale?
    ... precision of 15 and scale of 2. ... When I use a T-Sql update query, I'm sending a value "with pennies", but the ... I've added to the parameters collection of my update query command object, ...
    (microsoft.public.sqlserver.programming)
  • Re: Decimal Data Type losing scale?
    ... Is it possible that you've failed to specify precision and scale ... a decimal parameter is precision 18, ... >I CAN TYPE the pennies into the record in the table with Enterprise Mgr. ...
    (microsoft.public.sqlserver.programming)
  • Re: Check all
    ... this is on a continuous form and will append the table on a global ... scale. ... Run an Update query to update the table's Yes/No field to True, ...
    (microsoft.public.access.formscoding)
  • Re: .98 cents instead of .99
    ... store the amount as an int/long in pennies ... >or use BigDecimal to avoid floating point precision issues. ...
    (comp.lang.java.help)
  • Re: WEIGHT TO VOLUME RATIO
    ... > not a cheap ass, just a broke ass for the moment.have a friend with scale, ... > going to go over and pre-measure. ... then MAKE a simple two-pan balance and use PENNIES for "unit weights". ...
    (rec.pyrotechnics)