删除OUTCELL和INCELL中的-*和-*部分
DATEPERIODEXCHIDOUTCELLINCELL
12061418001900XCBSC1R12XC101A-J-XC101B
12061418001900XCBSC1R12XC101A-L-XC101C
12061418001900XCBSC1R12XC101A--XC104B
12061418001900XCBSC1R12XC101A-X-XC106A
12061418001900XCBSC1R12XC101A--XC106C
12061418001900XCBSC1R12XC101A-Y-XC111A
12061418001900XCBSC1R12XC101A--XC111B
12061418001900XCBSC1R12XC101A--XC111C
12061418001900XCBSC1R12XC101A--XC112B
12061418001900XCBSC1R12XC101A--XC118B
-----数据样子如上,当然数据量比较大,每天都有几万行。麻烦删除outcell的包含“-”和后面所有的字符,删除incell的前面“-”和之前的所有字符
求SQL语句
[解决办法]
update tb set outcell=left(outcell,charindex('-',outcell)-1),incell=right(incell,charindex('-',incell)-1)
[解决办法]
update yourtable set outcell = substring(outcell, 0, charindex('-', outcell)), incell = substring(incell, charindex('-', incell) + 1, len(incell))