When comparing numeric and decimal columns to columns of other numeric datatypes, such as money or int:
numeric and decimal precede integer and money columns in the hierarchy, so the index on the numeric or decimal column is the only index considered.
The precision and scale requirements must be met for the numeric or decimal index to be considered. The scale of the numeric column must be equal to, or greater than, the scale of the integer or money column, and the number of digits in the integer portion of the numeric column must be equal to or greater than the maximum number of digits usable for the integer or money column.
The precision and scale of integer and money types is shown in Table 19-3.
Datatype |
Precision, scale |
---|---|
tinyint |
3,0 |
smallint |
5,0 |
int |
10,0 |
smallmoney |
10,4 |
money |
19,4 |