消息 245,级别 16,状态 1,过程 xx,第 73 行在将 varchar 值 'xxx ' 转换成数据类
[align=left]select p.PSCode,PSName,p.RegionCode,r.RegionName,PSAddress,LINkman,c.PollutantCode,g.DataMonth, (g.LetCapacity),c.PollutantName,c.PollutantTypeCode ,d.OutputCode
from Dictionary.PollutantCode C,BaseOperationData.WaterOutputPollutionMonthLet g,PSInfo.PSBaseInfo p ,Dictionary.Region r,PSInfo.WaterOutput d where g.PSCode = p.PSCode AND p.Status =0 AND g.PSCode = d.PSCode AND g.OutputCode =d.OutputCode
AND d.Status=0 AND p.RegionCode = r.RegionCode AND c.PollutantTypeCode IN(1,2) AND g.DeleteFlag=0 AND c.PollutantCode=011 AND c.PollutantTypeCode=1 AND DataMonth BETWEEN 201301 AND 201301[/align]
---------------------------------------------------------------------------------
消息 245,级别 16,状态 1,过程 ProcQueryFourPolluteLet,第 73 行
在将 varchar 值 'select p.PSCode,PSName,p.RegionCode,r.RegionName,PSAddress,LINkman,c.PollutantCode,g.DataMonth, (g.LetCapacity),c.PollutantName,c.PollutantTypeCode ,d.OutputCode
from Dictionary.PollutantCode C,BaseOperationData.WaterOutputPollutionMonthLet g,PSInfo.PSBaseInfo p ,Dictionary.Region r,PSInfo.WaterOutput d where g.PSCode = p.PSCode AND p.Status =0 AND g.PSCode = d.PSCode AND g.OutputCode =d.OutputCode
AND d.Status=0 AND p.RegionCode = r.RegionCode AND c.PollutantTypeCode IN(1,2) AND g.DeleteFlag=0 AND c.PollutantCode=011 AND c.PollutantTypeCode=1 AND DataMonth BETWEEN 201301 AND 201301 ' 转换成数据类型 int 时失败。
------解决方案--------------------AND c.PollutantTypeCode IN(1,2) AND g.DeleteFlag=0
AND c.PollutantCode=011 AND c.PollutantTypeCode=1 AND DataMonth BETWEEN 201301 AND 201301
改为:
AND c.PollutantTypeCode IN('1','2') AND g.DeleteFlag=0
AND c.PollutantCode='011' AND c.PollutantTypeCode=1 AND DataMonth BETWEEN '201301' AND '201301'