我从Dapper Bulk Copy
遇到异常,好像底层的批量复制操作失败了。我将数据转储到json中,发现创建值的问题是259815703.3430760631
StackTrace:
at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
.....
Inner Exception 1:
InvalidOperationException: The given value of type Decimal from the data source
cannot be converted to type decimal of the specified target column.
Inner Exception 2:
ArgumentException: Parameter value '259815703.34307606' is out of range
该表具有decimal(18,6)
,而不是以较低的精度存储该API。
我尝试了以下操作,它可以正常工作,存储的值是6位小数而不是预期的10位
CREATE TABLE #t1(c1 DECIMAL(18,6))
INSERT INTO #t1(c1) values(259815703.3430760631)