如下,在Sqlserver里面trim函数不支持,希望帮忙给我将下面一段代码转换一下,非常感谢
trim(replace(replace(b.content2,':',''),'n','')) as 项目名称,
case
when instr(content_price2,'(元') > 0 then trim(replace(replace(substring_index(content_price2, '(元',1),':',''),':',''))
when instr(content_price2,'(万元') > 0 then trim(replace(replace(substring_index(content_price2, '(万元',1),':',''),':',''))
when instr(content_price2,'(人民币') > 0 then trim(replace(replace(substring_index(content_price2, '(人民币',1),':',''),':',''))
when instr(content_price2,' 万元') > 0 then trim(replace(replace(substring_index(content_price2, ' 万元',1),':',''),':',''))
when instr(content_price2,'万元') > 0 then trim(replace(replace(substring_index(content_price2, '万元',1),':',''),':',''))
when instr(content_price2,'元') > 0 then trim(replace(replace(substring_index(content_price2, '元',1),':',''),':',''))
else trim(replace(replace(content_price2,':',''),':',''))
end as 成交金额
rtrim(replace(replace(b.content2,':',''),'n','')) as 项目名称,
case
when charindex('(元', content_price2) > 0 then rtrim(replace(replace(substring(content_price2, 1, charindex('(元',content_price2)-1),':',''),':',''))
when charindex('(万元', content_price2) > 0 then rtrim(replace(replace(substring(content_price2, 1, charindex('(万元',content_price2)-1),':',''),':',''))
when charindex('(人民币', content_price2) > 0 then rtrim(replace(replace(substring(content_price2, 1, charindex('(人民币',content_price2)-1),':',''),':',''))
when charindex(' 万元', content_price2) > 0 then rtrim(replace(replace(substring(content_price2, 1, charindex(' 万元',content_price2)-1),':',''),':',''))
when charindex('万元', content_price2) > 0 then rtrim(replace(replace(substring(content_price2, 1, charindex('万元',content_price2)-1),':',''),':',''))
when charindex('元', content_price2) > 0 then rtrim(replace(replace(substring(content_price2, 1, charindex('元',content_price2)-1),':',''),':',''))
else rtrim(replace(replace(content_price2,':',''),':',''))
end as 成交金额