有这样的编码:
倉位
24C-01-00004
24C-01-00007
24C-01-00010
24C-01-00014
24C-01-00015
24C-01-00020
24C-01-00021

我想用一个sql 语句变成
倉位
24C0100004
24C0100007
24C0100010
24C0100014
24C0100015
24C0100020
24C0100021
如何实现?

解决方案 »

  1.   

    select 倉位=replace(倉位,'-','')) from tb
    --
      

  2.   

    select 倉位=replace(倉位,'-','')) from tb
      

  3.   


    declare @sql nvarchar(50)
    set @sql='24C-01-00004'
    select replace(@sql,'-','')24C0100004
      

  4.   

    CREATE TABLE Tb1
    (col1  varchar(20))
    insert into tb1
    select '24C-01-00004' 
    union
    select '24C-01-00007'
    union 
    select '24C-01-00010'
    union 
    select '24C-01-00014 '
    union 
    select '24C-01-00015' 
    union 
    select '24C-01-00020' 
    union 
    select '24C-01-00021' 
    update tb1 set col1=replace(col1,'-','')
    select * from tb1
    drop table tb1