<!--打赏 End-->

sqlserver 函数

create table test(x varchar(50));

insert into test
 select '134654哈哈他大爷123' union all
 select '????哈哈他大爷123' union all
 select ',,,,哈哈他大爷123' union all
 select '!!!!!!!!!!哈哈他大爷123'

 select * from test

 select x,
       y=substring(x,patindex('%[阿-做]%',x),50) from test

       select stuff(x,1,PATINDEX('%[吖-坐]%',x)-1,'') as y from test


 DECLARE @str VARCHAR(20);
SET @str='ADQG42陈奕丰A';
--select substring(@str,(2*len(@str)-datalength(@str)+1),(datalength(@str)-len(@str)))

--select stuff(@str,1,PATINDEX('%[吖-坐]%',@str)-1,'')
View Code

 

posted @ 2017-12-01 13:30  mikefts  阅读(83)  评论(0编辑  收藏  举报