Decimal
(Created page with "The decimal data type stores a precise value, including decimal places, which make it the recommended type for money. By default on SQL Server it's stored with 38 digits incl...")
 
No edit summary
Line 7: Line 7:
Precision on the attribute controls the number of digits in the attribute as a whole.
Precision on the attribute controls the number of digits in the attribute as a whole.


For example: Precision -1 and Scale 4 will create a 38 digit number with 4 digits as decimals.
For example: Precision 38 and Scale 4 will create a 38 digit number with 4 digits as decimals.
 
'''Note:''' You need to set '''both''' Precision and Scale to something other than -1, otherwise none of them will be used.

Revision as of 09:06, 10 July 2022

The decimal data type stores a precise value, including decimal places, which make it the recommended type for money.

By default on SQL Server it's stored with 38 digits including 2 decimal places.

You can change the number of decimal places by setting the Scale attribute on the attribute.

Precision on the attribute controls the number of digits in the attribute as a whole.

For example: Precision 38 and Scale 4 will create a 38 digit number with 4 digits as decimals.

Note: You need to set both Precision and Scale to something other than -1, otherwise none of them will be used.

This page was edited 84 days ago on 02/10/2024. What links here