select ${if("case when CONVERT(int,SUBSTRING(CONVERT(char(10),CONVERT(int,'202232') + CONVERT(int,'"+p_numberEditor0+"')), 5, 2)) > 52 then true else false end",if("case when SUBSTRING(CONVERT(char(10),CONVERT(int,'202232') + '"+ p_numberEditor0 +"'), 5, 2)-52 > 9 then true else false end","CONVERT(char(4),CONVERT(int,SUBSTRING('202232',1,4)) + 1) + '0' +CONVERT(char(2),(SUBSTRING(CONVERT(char(10),CONVERT(int,'202232') + '"+ p_numberEditor0 +"'), 5, 2)-52))","CONVERT(char(4),CONVERT(int,SUBSTRING('202232',1,4)) + 1)+CONVERT(char(2),(SUBSTRING(CONVERT(char(10),CONVERT(int,'202232') + '"+ p_numberEditor0 +"'), 5, 2)-52))"),"CONVERT(int,'202232') + '"+p_numberEditor0+"'")}
我只能写成这个样子,现在的问题是判断不了 >52周 和 大于减52是否大于9
with test_A as (
select '202232' test,
'202230' test1,
'测试数据' txt
)
select * from test_A
where test1>=(
select
case when SUBSTRING(CONVERT(char(10),CONVERT(int,test) + ${p_numberEditor0}), 5, 2) < 52 then CONVERT(int,test) + ${p_numberEditor0}
when SUBSTRING(CONVERT(char(10),CONVERT(int,test) + ${p_numberEditor0}), 5, 2)-52 < 10 then CONVERT(char(4),CONVERT(int,SUBSTRING(test,1,4)) + 1) + '0' +CONVERT(char(2),(SUBSTRING(CONVERT(char(10),CONVERT(int,test) + ${p_numberEditor0}), 5, 2)-52))
when SUBSTRING(CONVERT(char(10),CONVERT(int,test) + ${p_numberEditor0}), 5, 2)-52 > 9 then CONVERT(char(4),CONVERT(int,SUBSTRING(test,1,4)) + 1)+CONVERT(char(2),SUBSTRING(CONVERT(char(10),CONVERT(int,test) + ${p_numberEditor0}), 5, 2)-52)
end
from test_A)