有一个字段,数据中包含空格,比如130001     -01,230001      -01
我想去掉中间的空格,这么写这条语句?

解决方案 »

  1.   

    replace(col , ' ' , '')
      

  2.   

    update tab 
     set fldname=replace(fldname,' ','')
      

  3.   


    select replace('130001     -01,230001      -01 b',' ','8')
    '13000188888-01,230001888888-018b
    '
      

  4.   


    update tab 
     set colname=replace(colname,' ','')
    where charindex(' ',colname)>0
      

  5.   


    update tbname set 字段=replace(字段,' ','')
      

  6.   


    update tbname set 字段=left(6,字段)+'-01'
      

  7.   

    update tb t1=replace(t1,' ','')
      

  8.   


    create table a(a1 varchar(100))
    go
    insert into a
    select '130001     -01' union all
    select '230001      -01'select replace(a1,' ','') from a