数据表如下:
  零件号       数量
2402c/115      100
2402b/105      99
2400d/107      102
求一条语句将零件号字段中的'/' 改成'-' 改后如下:
  零件号       数量
2402c-115      100
2402b-105      99
2400d-107      102

解决方案 »

  1.   

    UPDATE TB SET [零件号]=REPLACE([零件号],'/','-')
      

  2.   

    update tb set [零件号]=REPLACE([零件号],'/','-')
    --REPLACE函数的利用
      

  3.   

    REPLACE(字符串,要替换的字符,替换的字符)
      

  4.   

    update tablename set [零件号]= replace([零件号],'/','-') where charindex('/',[零件号],1)>0
      

  5.   


    update tbname set 零件号=replace(零件号,'/','-') where charindex('/',零件号,1)>0
      

  6.   

    用REPLACE函数
    例如:
    update test set ljh=REPLACE(ljh,'/','-')
      

  7.   

    update test set  零件号=replace(零件号,'/','-')

    update test set  [零件号]=replace([零件号],'/','-')执行还是有一些区别在sql2000下
      

  8.   

    字符串函数的应用。replace可以了。