SQL Server - How to stop decimal datatype from Rounding?

Asked By Michael Parker on 22-Jan-07 01:26 PM

I have a variable which is a decimal, and I would like for it to hold the value that i give it. However, it tries to be helpful by roundins (not helpful).

I am looking at the modify columns for the existing table field that i wish would not round, and I am not determining how to make it not round.

Anybody got a clue on this?

Response - F Cali replied to Michael Parker on 22-Jan-07 02:40 PM

Can you post some sample values and the structure of your table as well as the command you are trying to execute to give us a better idea of what's happening.

SQL Server Helper FAQ
http://www.sql-server-helper.com/faq/index.aspx

Check the variable definition - Mark Firth replied to Michael Parker on 22-Jan-07 10:13 PM

Check the precision of your variable definition and the definition of any fields that are used in the calculations. These can impact on the resulting data.

I often use Decimal(30,10) to limit the rounding impact. This can be a problem as you will sometimes get 0.000000001 from a conversion.

Use Float datatype - Rajesh Madhukar replied to Michael Parker on 24-Jan-07 12:22 AM

end of post
float/decimal - chin jun replied to Rajesh Madhukar on 14-Oct-08 11:56 AM

hi rajesh,


I am getting a value from data base as a float like 123.44555 so i want to limit total length to 7 including decimal so how to do it