select replace(字段,'aa','bb')
from 表

解决方案 »

  1.   

    select replace(name,'aa','bb')
    from sysobjects 
    where type='U' and name like '%_aa_%'
      

  2.   

    sp_rename
    更改当前数据库中用户创建对象(如表、列或用户定义数据类型)的名称。具体见帮助
      

  3.   

    --是是下面的存储过程
    Create Procedure P_RepalceName As 
    Declare @Name VarChar(100),@RepalceName  VarChar(100)
    Declare Other_Cursor Cursor For 
    Select Name,Replace(Name,'aa','bb') From sysobjects Where type='U' And Name Like '%_aa_%'
    Open Other_Cursor
    Fetch Next From Other_Cursor Into @Name,@RepalceName 
    While @@FETCH_STATUS = 0
    Begin
    EXEC sp_rename @Name,@RepalceName
    Fetch Next From Other_Cursor Into @Name,@RepalceName 
    End 
    Close Other_Cursor
    Deallocate Other_CursorgoExec P_RepalceName 
    go 
    Drop Procedure P_RepalceName
      

  4.   

    强,高手真不是随便就能练成的啊 iwl() 兄,正解 顶者都有分