decimal[ (38,2) (1 Viewer)

zezo2021

Member
Local time
Today, 15:50
Joined
Mar 25, 2021
Messages
381
if I create a field with this size decimal[ (38,2)

is this affect the performance?

maybe I will use a small number or not use the all 38 number
 

Minty

AWF VIP
Local time
Today, 14:50
Joined
Jul 26, 2013
Messages
10,371
It will affect the amount of storage used:

Storage considerations with Decimal Data Type in SQL Server​

Data type SQL Decimal requires the following storage bytes for the specified precision as provided by Microsoft below:

PrecisionStorage (Bytes)
1 – 95
10 – 199
20 – 2813
29 – 3817
 

tvanstiphout

Active member
Local time
Today, 06:50
Joined
Jan 22, 2016
Messages
222
I would stay away from the Decimal data type if you can. It is poorly supported in VBA.
Would Currency work for you? It is not just for monetary values.
 

zezo2021

Member
Local time
Today, 15:50
Joined
Mar 25, 2021
Messages
381
It will affect the amount of storage used:

Storage considerations with Decimal Data Type in SQL Server​

Data type SQL Decimal requires the following storage bytes for the specified precision as provided by Microsoft below:

PrecisionStorage (Bytes)
1 – 95
10 – 199
20 – 2813
29 – 3817

if I use the max 38 and store 1-9 examples for the number 100052.22
is the storage become 17
 

zezo2021

Member
Local time
Today, 15:50
Joined
Mar 25, 2021
Messages
381
It will affect the amount of storage used:

Storage considerations with Decimal Data Type in SQL Server​

Data type SQL Decimal requires the following storage bytes for the specified precision as provided by Microsoft below:

PrecisionStorage (Bytes)
1 – 95
10 – 199
20 – 2813
29 – 3817

based on this table
this is not dynamic storage (variable)
1-9 storage 5 bytes not affected by increasing or decreasing the number

is this correct?
@Minty
 

Minty

AWF VIP
Local time
Today, 14:50
Joined
Jul 26, 2013
Messages
10,371
No. The storage requirement is set by the precision set in the data type.

If you specify Decimal(38,2) in the table design any value stored will take 17 bytes.
If you specify (9,2) it will take 5 bytes.
 

zezo2021

Member
Local time
Today, 15:50
Joined
Mar 25, 2021
Messages
381
No. The storage requirement is set by the precision set in the data type.

If you specify Decimal(38,2) in the table design any value stored will take 17 bytes.
If you specify (9,2) it will take 5 bytes.
:unsure: :unsure: :unsure: :unsure:

Is this the correct input
Decimal (4,2) = storage will be 5 bytes
 

Minty

AWF VIP
Local time
Today, 14:50
Joined
Jul 26, 2013
Messages
10,371
Correct, regardless of what you store in it.
The maximum values would be -99.99 to 99.99

You can test this in SSMS quite easily.
 

Users who are viewing this thread

Top Bottom