UPDATE ListDetail SET SL=DJ*DCYL
WHERE CJRWH=@CJRWH
AND charindex('*',料号)>0
AND (substring(料号,1,2)='3Y' and (substring(料号,1,3) not in('3YA''3YB','3YC')))
--AND ((cast(substring(料号,3,2) as int)>=12) and (cast(substring(料号,3,2) as int)<=20))
AND (substring(料号,3,2) in ('12','13','14','15','16','17','18','19','20'))
===问题:为什么不能转换成数字类型比较大小,语句能执行且不报错,就是不起作用。
------解决方案--------------------
你的意思是用这个:
AND ((cast(substring(料号,3,2) as int)>=12) and (cast(substring(料号,3,2) as int)<=20))
替换 AND (substring(料号,3,2) in ('12','13','14','15','16','17','18','19','20'))
之后,没有起作用吗?
------解决方案--------------------
2000有没有isnumeric函数?有的话测试一下cast(substring(料号,3,2) as int)是否为数值型