Figured it out: I had a vague de ja vu about this when I went and looked at some of the other SQL Server data type options and saw real and float. Sure enough, what was going on was that the value to push was 1.3400, which, evidently, is not exactly expressible in binary, so it was getting converted to 1.3399etc., etc. (out to 14 digits). Furthermore, also evidently, decimal has some safeguard not possessed by real, whereby the former data type balks at the two numbers not being identical, but the latter doesn’t, i.e., the former returns the error, but the latter allows the push...but of the binary approximation, i.e., the result in my database is the 1.3399etc., etc. number. I read that real is synonymous w/ "short" (i.e., four byte mantissa representation), while float allows for "double" (eight byte)--my understanding of all that mumbo jumbo is such that I'll have to find out empirically if that enables the number to be represented as 1.3400(0...0) (or, just as good, 1.339...9 or 1.340...01). Thanks for reading; sorry for the noise.
Re Database Toolbox: "Arithmetic overflow error converting numeric to data type numeric"
3 ビュー (過去 30 日間)
古いコメントを表示
Hi! I'm getting the follwoing trying to use update:
[Microsoft][ODBC SQL Server Driver][SQL Server]Arithmetic overflow error converting numeric to data type numeric.
Google-ing, I find that this error is typically returned when the input exceeds the precision and/or scale of the target, but, at least as far as I can see, this is not the case 'cause my target is type decimal(18,18), but my input has only 15 digits, 1 to the left of and 14 to the right of the decimal place. Any ideas? Thanks!
0 件のコメント
採用された回答
David Goldsmith
2012 年 2 月 15 日
3 件のコメント
Kaustubha Govind
2012 年 2 月 16 日
Glad you were able to figure it out. Thanks for posting the solution!
その他の回答 (1 件)
Kaustubha Govind
2012 年 2 月 15 日
I don't know anything about SQL, but doesn't decimal(18,18) mean that you can have zero digits before the decimal point, and 18 digits after the decimal point? In other words, you can only store values between 0 and 1e-18. I think your format needs to be at least decimal(18, 17) to store a number that has 1 to the left of and 14 to the right of the decimal place.
参考
カテゴリ
Help Center および File Exchange で Data Type Conversion についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!