一个字段的值,除括号和里面的内容
   title
A 阿斯顿·马丁 (13)
阿斯顿·马丁
V12 Vantage (1)
V8 Vantage (4)
阿斯顿马丁DB9 (4)
阿斯顿马丁DBS (4)
要个效果是:
    title
A 阿斯顿·马丁 
阿斯顿·马丁
V12 Vantage 
V8 Vantage 
阿斯顿马丁DB9 
阿斯顿马丁DBS 

解决方案 »

  1.   

    select left(title,charindex('(',title)-1) from tb
      

  2.   

    select 
       case when charindex('(',title)>0 and charindex(')',title) > charindex('(',title)
           then stuff(title,charindex('(',title),charindex(')',title)-charindex('(',title),'')
           else title
           end as title
    from tab
      

  3.   

           create table tb(title varchar(20))
    insert into tb
    select 'A 阿斯顿·马丁 (13)' union
    select '阿斯顿·马丁' union
    select 'V12 Vantage (1)'union 
    select 'V8 Vantage (4)'union 
    select '阿斯顿马丁DB9 (4)'union
    select '阿斯顿马丁DBS (4)'select case when charindex('(',title)=0 then title else substring(title,1,charindex('(',title)-1) end as title
    from tb