geeting错误:将数据类型nvarchar转换为数值时出错. [英] geeting error :Error converting data type nvarchar to numeric.
本文介绍了geeting错误:将数据类型nvarchar转换为数值时出错.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SELECT DISTINCT
T0.Jobcard, T0.Operator, T1.JobCardQty, T0.Mouldqty, T0.Process, T0.Profilename, T0.Remark, T0.Date, T1.U_od, T0.Supervisor, T2.SizeFrom,
T2.SizeTo, (T0.Mouldqty * T2.Rate + T2.DieSetting) AS Cost, T3.Division
FROM SAPProduction.ProductionData AS T0 INNER JOIN
SAPProduction.RateChartData AS T1 ON T0.Jobcard = T1.Jobcard COLLATE SQL_Latin1_General_CP850_CI_AS INNER JOIN
SAPProduction.ProductionRateTable AS T2 ON T0.Process = T2.Process INNER JOIN
SAPProduction.ProductionMaterialMaster AS T4 ON T2.Process = T4.process INNER JOIN
SAPProduction.ProductionDivisionMaster AS T3 ON T2.ChartType = T3.fid
WHERE (T1.U_od BETWEEN T2.SizeFrom AND T2.SizeTo)
推荐答案
查找这些列的数据类型是什么:
T0.Mouldqty
T2.Rate
T2.DieSetting
T2.ChartType
T3.fid
T1.U_od
T2.SizeFrom
T2.SizeTo
如果T2.ChartType = T3.fid均为数字,则将其更改为字符(我怀疑ChartType为character而fid不是)
如果与数字结合使用,SQL将尝试使字符成为数字.
由于T0.Mouldqty * T2.Rate + T2.DieSetting是方程式,如果有任何非数字类型,请使用CAST或CONVERT函数.
如果在T2.SizeFrom和T2.SizeTo之间有任何T1.U_od是字符,我将更改为数字.
Find what the data type is for these columns:
T0.Mouldqty
T2.Rate
T2.DieSetting
T2.ChartType
T3.fid
T1.U_od
T2.SizeFrom
T2.SizeTo
If T2.ChartType = T3.fid either are a numeric change it to character (I suspect ChartType is character and fid is not)
SQL will try and make characters into a numeric if used in combination with a numeric.
Since T0.Mouldqty * T2.Rate + T2.DieSetting is an equation if any are not a numeric type use the CAST or CONVERT function.
If any T1.U_od BETWEEN T2.SizeFrom AND T2.SizeTo are character I would change to numeric.
您在nvarchar中存储的内容(如果它是某种数字)则只能将其转换变成数字,否则出错.
what you have store in nvarchar if its some kind of number then only it can be converted into numeric else so error.
这篇关于geeting错误:将数据类型nvarchar转换为数值时出错.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文