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.)
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 only5
.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.)