使用链接服务器的数据库连接。 (数值)
因此,我建立了从 SQL Server 2008 Express Edition 到 Oracle 数据库的连接。 当我查询基于 varchar 的值时,这很好,但对于任何数值,它都会向我抛出这样的错误。
Msg 9803, Level 16, State 1, Line 1
Invalid data for type "numeric".
我该如何解决这个问题?
So I established a connection from my SQL Server 2008 Express Edition to our Oracle Database.
When I query varchar based values, it is fine, but for any numeric value, it throws me an error like this one.
Msg 9803, Level 16, State 1, Line 1
Invalid data for type "numeric".
How do I get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我自己也遇到过这个。您的错误是由链接未正确处理数字字段引起的。最简单的修复方法是在 OPENQUERY 中强制转换为 varchar,然后在另一端强制转换回数字
I've run into this myself. Your error is caused by Number fields not being properly handled by the linkage. The easiest fix is to cast to a varchar inside your OPENQUERY, and to cast back to a number on the other side
一位人士表示,他们在 Oracle 的 Metalink DocID 369814.1 中找到了答案。他们表示,解决方案是安装最低版本为 10.2.0.2.20 的 Oracle OLEDB 驱动程序。
他们安装了 Oracle 客户端 10.2.0.3,然后应用了适用的补丁(Metalink DocID 369814.1 中描述)。
我在 http://forums 找到了这篇文章。 oracle.com/forums/thread.jspa?threadID=337842&start=15&tstart=135。
这似乎是比转换为 char 数据类型,然后转换回数字数据类型更好的解决方案。我认为这些转换会降低你的性能。
One individual said that they found the answer in Oracle's Metalink DocID 369814.1. They said the solution is to install an Oracle OLEDB driver with minimum version 10.2.0.2.20.
They installed an Oracle client 10.2.0.3 and then applied the applicable patch (described in the Metalink DocID 369814.1).
I found this post at http://forums.oracle.com/forums/thread.jspa?threadID=337842&start=15&tstart=135.
This seems like a better solution than converting to a char datatype, then converting back to a numeric datatype. I assume that those conversions will cost you in performance.
我们在其中一个环境中遇到了同样的问题,问题是我们错误地设置了链接服务器。
我们将其更改为 Microsoft OLD DB Provider for Oracle,问题得到解决。希望这有帮助。
We had the same problem in one of our environments and the problem was that we had set up the linked server incorrectly.
We changed it to Microsoft OLD DB Provider for Oracle and the problems was resolved. Hope this helps.