runtime
runtime copied to clipboard
Plain zero insertion error when SqlBulkCopy
SqlDecimal 0 has precision 1 scale 0. When the scale is adjusted by n (n>0), currently, n is just added up to both prevision and scale, which makes precision 1+n and scale 0+n. Adjusting scale by 2 converts SqlDecimal 0 (precision 1, scale 0) into 0.00 with precision 3 and scale 2. This caused an issue on SqlBulkcopy, when a row with SqlDecimal 0 in DataTable was being inserted to a table which has decimal(2,2) type in the corresponding column.
The bug was fixed: https://github.com/dotnet/corefx/pull/22926