高手帮帮忙...小弟第一次工作..要清理一些数据库的立即信息。 .用函数字段中'<'号后面的内容全部去掉update a set ziduan=.....

解决方案 »

  1.   

    update a set ziduan=replace(ziduan,'<','')
      

  2.   

    if object_id('tb') is not null
    drop table tb
    go
    create table tb(bb varchar(8000))
    insert into tb select 'abd<asfasdf'
    update tb set bb=left(bb,patindex('%<%',bb)-1)
    select * from tbabd
      

  3.   

    if object_id('tb') is not null
    drop table tb
    go
    create table tb(bb varchar(8000))
    insert into tb select 'abd<asfasdf'
    insert into tb select ''
    insert into tb select null
    update tb set bb=case when patindex('%<%',bb)>0 then left(bb,patindex('%<%',bb)-1) else bb end
    select * from tbabdNULL考虑了''和null的替换
      

  4.   

    update a set ziduan=left(ziduan,charindex('<',ziduan)-1) where ziduan like '%<%'