We're updating the issue view to help you get more done. 

Decimal truncation occurs after 5 digits

Description

With Sql Server, setting a decimal parameter without specifying its precision and scale will cause any fractional part longest than 5 digits to be truncated, unless its precise precision and scale was determined by the query parsing (which usually occurs in case of simple comparison with an entity property).

This is due to an optimization for SQL Server query plan cache which set decimal parameters precision and scale to their "max" values in SqlClientDriver if they do not specify those themselves. And "max" scale is only 5.

Any way, max scale is non-sens, since it is indeed equal to precision for most databases, in which case their are no more digits before the dot. It is more a default scale.

Such an optimization, causing parameter truncation, should not be enable by default. Such a default scale should be at least configurable. (Or completely removed.)

Environment

SQL Server

Status

Assignee

Unassigned

Reporter

Frédéric Delaporte

Labels

Components

Fix versions

Affects versions

4.1.1

Priority

Minor