0

One of the field in an existing SQL table is Decimal (5,5) with no foreign key relationships. Developers wants to change it to Decimal (7,5).

What will be the downside of making such changes wich has existing data? Is there any chance of the application not working after making such changes?

1 Answer 1

2

You are increasing the precision (number of digits). But for sql-server the same 5 bytes are used for precision 1 to 9. So the field length will not change. Which means that even the database size should not change.

Reference, as pointed out by @DanGuzman learn.microsoft

Normally with field length changes, special care is required for stored procedures, functions, and triggers if there are dependencies on the size, such as variables that may not be large enough to contain the new value (either raw as a result of an expression).

In this case no changes are necessary.

2
  • Increasing the precision from 5 to 7 does not increase the field length. Per the documentation, precision 1-9 requires 5 bytes of storage. Every row will be updated as you said and one needs to be mindful of dependencies.
    – Dan Guzman
    Commented Feb 2, 2023 at 9:54
  • @DanGuzman - OOps, corrected it. I didnt find it when I was searching for storage size. Commented Feb 2, 2023 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.