问题描述
选择
推荐答案
我想我们是谈论:CAST(PMMult AS DECIMAL(10,3))AS [PMMult]
I guess we're talking about: CAST(PMMult AS DECIMAL(10, 3)) AS [PMMult]
所以这是一个数据值相反的期望问题。例如。您的传入值是"ABC"您想要转换为DECIMAL。无论如何,这都无济于事。
So this is a data values versa expectation issue. E.g. your incoming value is "ABC" that you want to convert to DECIMAL. This is not going to work no matter what.
让我们讨论可能的解决方案:
Let's discuss the possible solutions:
1)您可以使用(取决于SQL Server版本)
CASE WHY TRY CAST
1) You can use (depends on the SQL Server version) CASE WHEN TRY CAST
2)您可以清理或过滤数据以消除违规行。
当然会导致数据丢失/您的企业需要同意或不同意的修改。
2) You can clean or filter the data to eliminate the offending rows
Of course it causes data loss / modifications that your business needs to agree or not with.
这篇关于OLE DB记录可用。来源:“Microsoft SQL Server Native Client 11.0” Hresult:0x80004005描述:“将数据类型varchar转换为数字时出错。”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!