SELECT
replace(newid(), '-', ''),
e.equip_id,
e.equip_name,
CASE
WHEN s.project_fee IS NULL THEN 0
ELSE cast(SUBSTRING (s.project_fee,0,patindex('%/%', s.project_fee)) as decimal(15,2)) --这里的转换有问题
END AS project_fee
FROM
sheetEquip s
LEFT JOIN ams_equip e ON e.equip_no = s.equip_no
------解决方案-------------------- where isnumeric(SUBSTRING (s.project_fee,0,patindex('%/%', s.project_fee)))=0
那就查一下哪些数据有问题 ------解决方案--------------------
确实不是位置问题,应该是数据问题,检查一下表的数据:
select top 1 project_fee from sheetEquip where isnumeric( SUBSTRING (project_fee,0,patindex('%/%', project_fee)) ) = 0