日期:2014-05-17 浏览次数:20397 次
declare @t table([arrid] varchar(11))
insert @t
select '0,1,177,181' union all
select '0,1,177,182' union all
select '0,1,183' union all
select '0,1,183,184' union all
select '0,1,183,185'
--第一种
select reverse(right(reverse(arrid),len(arrid)-charindex(',',reverse(arrid)))) from @t
--第二种
select left(arrid,len(arrid)-charindex(',',reverse(arrid))) from @t
--最后一个符号后面的数据长度固定
update tb1 set arrid=substring(arrid,1,LEN(arrid)-4)
--不固定
update tb1 set arrid=substring(arrid,1,len(arrid)-charindex(',',reverse(arrid)))