你好,大大,这3个case when 和 len\ Substring 组合起来的sql,是什么意思?
(Case when len(b.gysddhm)>=12 Then
(Case when (len(b.gysddhm)=13 Or len(b.gysddhm)=15) Then SubString(b.gysddhm,1,len(b.gysddhm)-1)+'1' else
(Case when (len(b.gysddhm)=17 and b.cpx='DP') then SubString(b.gysddhm,1,len(b.gysddhm)-
5)+'1'+SubString(b.gysddhm,len(b.gysddhm)-3,1)+'1'+ SubString(b.gysddhm,len(b.gysddhm)-1,2) else
SubString(b.gysddhm,1,len(b.gysddhm)-2)+'1'+SubString(b.gysddhm,len(b.gysddhm),1) end)
end)
else '456' end)