The scale must be less than or equal to the precision.

To avoid the error below points can be followed.

- The scale must be within the range of 0 and the value of the precision. This can easily be done by increasing the value of the precision to include the digits both before and after the decimal point
- In the case of the incorrect scale in the definition of a DECIMAL or NUMERIC data type in column of a table, simply increase the size of the precision to include the digits both before and after the decimal point.

**Try to find out the error:**

DECIMAL ( p [, s] ) NUMERIC ( p [, s] )

Precision (p) is the maximum number of decimal digits that can be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.

The optional scale (s) is the maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through the value of the precision (p). Scale can only be specified if precision is specified. The default scale is 0.

Given the definition of the precision and scale of a DECIMAL or NUMERIC data type, this error message will be encountered if the specified scale is greater than the precision when defining a local variable.

`DECLARE @Pi DECIMAL(1, 6) -- 3.141592`

DECLARE @Latitude DECIMAL(2, 6) DECLARE @Longitue DECIMAL(3, 6)

CREATE TABLE [dbo].[Product] ( [ProductID] INT, [ProductName] VARCHAR(100), [Width] DECIMAL(4, 6), [Length] DECIMAL(4, 6), [Height] DECIMAL(4, 6) )

**To avoid this error**, as the error message suggests, the scale must be within the range of 0 and the value of the precision. This can easily be done by increasing the value of the precision to include the digits both before and after the decimal point.

Here’s an updated version of the scripts earlier that fixes the issue:

```
DECLARE @Pi DECIMAL(7, 6) -- 3.141592
DECLARE @Latitude DECIMAL(8, 6) –- 2 Digits to the left and 6 digits to the right.
DECLARE @Longitue DECIMAL(9, 6) –- 3 Digits to the left and 6 digits to the right.
```

In the case of the incorrect scale in the definition of a DECIMAL or NUMERIC data type in column of a table, simply increase the size of the precision to include the digits both before and after the decimal point.

CREATE TABLE [dbo].[Product] ( [ProductID] INT, [ProductName] VARCHAR(100), [Width] DECIMAL(10, 6), [Length] DECIMAL(10, 6), [Height] DECIMAL(10, 6) )