Sql – MS SQL Server decimal data type rounds up

decimalsqlsql-server-2008types

I need to be able to store numbers like 3.5 in my table. So I've used the decimal type field. But if I enter 3.5 it round it up to 4. Am I being stupid or is it not the point of decimal to have a decimal point?

Best Answer

You need to declare it like decimal(18,3) to specify the number of digits after the point.

In case you are using stored procedure parameter also must have precision specified next to decimal, e.g. decimal(18,3)