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
原文地址:https://www.cnblogs.com/futengsheng/p/7941794.html