Convert decimal column (18.8) to another decimal column (18.18)

I have a column with a decimal value of 18.8. I was asked to extend it to 18.18 in order to spend more places after ,.

ALTER TABLE [dbo].[TransakcjeGotowkowe]
ALTER COLUMN TransakcjeGotowkoweKwota decimal (18,18) NULL

Msg 8115, Level 16, State 8, Line 1
Arithmetic overflow error converting numeric to data type numeric.
The statement has been terminated.

I also tried to do this using a graphical interface. Nothing else will change, you just need to save more data after.

Is there any other way to do this?

+3
source share
2 answers

The decimal data type consists of (precision, scale)

Accuracy is the total number of digits to the left and right of the decimal point.

Scale is the number of digits to the right of the decimal point.

If you want to increase the number of digits on the right to 18, you will need to increase the overall accuracy. In your case, increase it by 10.

, decimal(28,18)

MSDN

+4

28,18. 10 .

18,18 +/-0.999999999999999999

+2

Source: https://habr.com/ru/post/1770721/


All Articles