Reputation: 3412
My column's datatype is decimal(18,0)
but when I am entering value in to database 2.3
it changes into 2
.
Upvotes: 0
Views: 913
Reputation: 21776
For storing this value field should have a type of decimal(18,1)
Check it:
SELECT CAST(2.3 as decimal(18,0))
SELECT CAST(2.3 as decimal(18,1))
Upvotes: 3
Reputation: 45789
decimal(18, 0)
means that you want to create a decimal field which stores:
That explains why 2.3
is being turned into 2
. For further detail, see the msdn documentation for the decimal datatype.
Upvotes: 3