假设表是table,字段是email
现在这个email字段里面存的是10000条email值,
我现在要将email字段的所有email值的第二个字母X都去掉.
比如原来是[email protected]
[email protected]
[email protected]需要说明的是原来的email记录的所有第二个字母确实是某个特定字母x
是后来特意加到email里面的,我现在要恢复到原来的真实email,所以要去掉这个
x.请问sql 语句怎么写呢?

解决方案 »

  1.   

    update tbName set email=stuff(email, 2, 1, '')
      

  2.   

    update table set email=stuff(email,2,1,'')
      

  3.   

    create table T(email varchar(20))
    insert T select  '[email protected]'
    union all select '[email protected]'
    union all select '[email protected]'update T set email=stuff(email, 2, 1, '')
    where substring(email, 2, 1)='x'select * from T --result
    email                
    -------------------- 
    [email protected]
    [email protected]
    [email protected](3 row(s) affected)
      

  4.   

    update tbName set email=stuff(email, 2, 1, '')
      

  5.   

    marco08(天道酬勤) 简直就是自动答题机,忍不住要赞美一下:)