Skip to content

SQLServerBulkCopy doesn't check BigDecimal scale #230

@Arthurm1

Description

@Arthurm1

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

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions