日期:2014-05-18 浏览次数:20811 次
create table tb(col nvarchar(30))
insert into tb select '123'
insert into tb select '我爱你123、1223'
insert into tb select '我爱你123我爱你1234我爱你123'
insert into tb select '我爱你123我爱你'
insert into tb select '123我爱你'
go
select substring(col,PATINDEX('%[^吖-做]%',col),len(col)-Patindex('%[^吖-做]%',REVERSE(col))-PATINDEX('%[^吖-做]%',col)+2) from tb
/*
------------------------------
123
123、1223
123我爱你1234我爱你123
123
123
(5 行受影响)
*/
go
drop table tb