Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

I'm trying to figure out decimal data type of a column in the SQL Server. I need to be able to store values like 15.5, 26.9, 24.7, 9.8, etc

I assigned decimal(18, 0) to the column data type but this not allowing me to store these values.

What is the right way to do this?

1 Answer

0 votes
by (40.7k points)

If you use, DECIMAL(18,0) it’ll allow 0 digits after the decimal point.

Instead of DECIMAL(18,0)use DECIMAL(18,4) because it’ll give you 18 digits, in which 4 digits will come after the decimal point and 14 digits will come before the decimal point.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...