SqlServer截取最后一个符号前的所有字符
原来:aa–bb–cc
截取后:aa–bb
select reverse(substring(reverse(字段),CHARINDEX(’–’,reverse(字段))+2 ,LEN(字段) )) from table where 条件=‘abc’
原来:aa–bb–cc
截取后:aa–bb
select reverse(substring(reverse(字段),CHARINDEX(’–’,reverse(字段))+2 ,LEN(字段) )) from table where 条件=‘abc’