• 您的位置我爱Aspx >> 数据库 >> 存储过程替换text,ntext列中的字符串
  • 存储过程替换text,ntext列中的字符串

  • 作者:aspxer  来源:internet  日期:2007-5-22 0:33:00  关键字:
  • 存储过程替换text,ntext列中的字符串

    >

    /*

    author:amjn

    date:2003-03-28

    version:1.0

    function:替换text,ntext列中的字符串(不支持中文)

    */

    declare @ptr varbinary(16)

    declare @amjnId int

    declare @Position int,@len int

    set @len=datalength(@#ILOVEHJL@#)

    declare wux_Cursor scroll Cursor

    for

    select textptr([Name]),[amjnId] from USA201

    for read only

    open wux_Cursor

    fetch next from wux_Cursor into @ptr,@amjnId

    while @@fetch_status=0

    begin

    select @Position=patindex(@#%ILOVEHJL%@#,[Name]) from USA201 where [amjnId]=@amjnId

    while @Position>0

    begin

    set @Position=@Position-1

    updatetext USA201.[Name] @ptr @Position @len @#i love hjl@#

    select @Position=patindex(@#%ILOVEHJL%@#,[Name]) from USA201 where [amjnId]=@amjnId

    end

    fetch next from wux_Cursor into @ptr,@amjnId

    end

    close wux_cursor

    deallocate wux_cursor

    go

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:深入探索MS SQL Server 2000网络连接的安全问题
    下一篇:更新sql server的联机丛书
  • 相关文章