Skip to content
Advertisement

How can i Set decimal value in SQL (something like 10.12345678)

Can’t store decimal value in SQL. Want to store like decimal(2,8)

Like 32.12345678

In NuGet Consol

Advertisement

Answer

Your issue is a slight misunderstanding of the decimal data type. The first part of the declaration is the total length of the data field, the second is the amount of those that are decimals.

For example: decimal(5,3) shows a precision of 5 total digits, 3 of those are decimal places (12.345).

I think you are looking for the data type decimal(10,8) which would give you 10 total digits, with 8 of those coming after the decimal place

Here’s a link to the documentation that explains how the precision works;

https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql?view=sql-server-2017

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement