现有一张表 abc
 abc(字段名) ||| a ||| b我想把abc里的值改成这样 abc(字段名) a bsql语句要咋写啊??

解决方案 »

  1.   

    update abc 
    set abc=replace(abc,'|||','')
      

  2.   

    update abc
    set abc = replace(abc,'|||','')
      

  3.   

    update abc set abc=replace(abc,'|||','') --去掉abc字段中所有 |||
    update abc set abc=stuff(abc,1,3,'') where abc like '|||%' --去掉前字段前三个含有|||的字符
      

  4.   

    -->>测试数据
    if object_id('tbc') is not null
    drop table [tbc]
    create table [abc] (abc varchar(15))
    insert  [abc] (abc) values('||| a')
    insert [abc](abc) values('||| b')
    -->>查询表
    select * from abc
    -->>字段abc处理
    select right(abc,1) as 'abc'from [abc]
    select replace(abc,'|||','') as 'abc' from [abc]
    -->>查询结果
    /*abc
      a
      b
    */
      

  5.   

    -->>测试数据
    if object_id('tbc') is not null
    drop table [tbc]
    create table [abc] (abc varchar(15))
    insert  [abc] (abc) values('||| a')
    insert [abc](abc) values('||| b')
    -->>查询表
    select * from abc
    -->>字段abc处理
    select right(abc,1) as 'abc'from [abc]
    select replace(abc,'|||','') as 'abc' from [abc]
    -->>update字段处理
    update [abc] set abc=right(abc,1)
    -->>查询结果
    /*abc
      a
      b
    */
      

  6.   

    update abc
    update 表名 set 字段名 = replace(字段名,'|','')
      

  7.   

    update abc set abc=sumstring(a,3,len(a))