When using SQLServerBulkCopy to import a BigDecimal into a Numeric column the scale isn't checked.
If the column metadata is defined as a Decimal(10, 4) and then new BigDecimal("1").setScale(2, RoundingMode.HALF_UP) is passed the table will end up with a value of 0.01 instead of 1.0
I think it would be safer if the IOBuffer.writeBigDecimal was passed bulkScale by the SQLServerBulkCopy.writeColumnToTdsWriter method and then threw an exception when the bigDecimalVal.scale() differed from bulkScale
When using
SQLServerBulkCopyto import aBigDecimalinto aNumericcolumn the scale isn't checked.If the column metadata is defined as a
Decimal(10, 4)and thennew BigDecimal("1").setScale(2, RoundingMode.HALF_UP)is passed the table will end up with a value of 0.01 instead of 1.0I think it would be safer if the
IOBuffer.writeBigDecimalwas passedbulkScaleby theSQLServerBulkCopy.writeColumnToTdsWritermethod and then threw an exception when thebigDecimalVal.scale()differed frombulkScale