adfdfsd(ab cc)
adfdfsd(cs ac)
adfdfsd(afe cdfc)
...
怎么查询出ab cc
cs ac
afe cdfc

解决方案 »

  1.   


    select substring(col,charindex('(',col)+1,charindex(')',col)-charindex('(',col)-1) col
    from tb
      

  2.   


    declare @t table (colname varchar(20))
    insert into @t
    select 'adfdfsd(ab cc)' union all
    select 'adfdfsd(cs ac)' union all
    select 'adfdfsd(afe cdfc)'select 
    parsename(replace(replace(replace(colname,'(','.'),')','.')+'1',' ','.'),3),
    parsename(replace(replace(replace(colname,'(','.'),')','.')+'1',' ','.'),2)
    from @t
      

  3.   

    select
     substring(col,charindex('(',col)+1,charindex(')',col)-charindex('(',col)-1)   as col
    from
     tb