字符替换的几种方式 实例如下

 

create table #s 


(name char(30))

insert into #s select '(限50)aaas'
insert into #s select '(限5)aaa1'
insert into #s select '(限100)aaa2'

 

select  STUFF(name,1, CHARINDEX(')',name),'')     as name  from #s

select RIGHT(rtrim(name),len(name)-charindex(')',name))name from #s

select STUFF(name,1, len(left( name,CHARINDEX(')',name) )) ,'') as name from #s
 

name
------------------------------
aaas
aaa1
aaa2

(3 行受影响)

 

http://topic.csdn.net/u/20111219/13/9730f748-6f2c-4f42-a821-2021562f3305.html?seed=1335288274&r=76990485#r_76990485

 

你可能感兴趣的:(字符替换的几种方式 实例如下)