• Replace ntext类型中的文字


    2007-09-17 18:37
    create table #temp (rowid int,textcol ntext
    insert into   #temp values (1,'aaa bbb ccc ddd eee'
    insert into   #temp values (2,'aaa bbb cc ddd eee'
    insert into   #temp values (3,'fff ggg ccc iii jjj'
    declare @from nvarchar(100), @to nvarchar(100), @pos int@len int@rowid int 
    declare @ptrval binary(16
    set @from='ccc' 
    set @to='hhh' 
    set @len = len(@from
    set @rowid = 0 
    select @rowid = rowid,@pos = charindex(@from,textcol)-1 from #temp where 
    charindex(@from,textcol) > 0 
    while (@rowid > 0
    begin 
    select @ptrval = textptr(textcol) from #temp where rowid = @rowid 
    updatetext #temp.textcol @ptrval @pos @len @to 
    set @rowid = 0 
    select @rowid = rowid,@pos = charindex(@from,textcol)-1 from #temp where 
    charindex(@from,textcol) > 0 
    end 
    select * from #temp 
    drop table #temp
  • 相关阅读:
    windows禅道环境搭建
    python-django开发学习笔记四
    迭代器
    小数据池
    正则表达式
    文件操作
    深浅拷贝
    隐藏文件夹命令
    python解释器安装教程以及环境变量配置
    计算机基础应用
  • 原文地址:https://www.cnblogs.com/qingyun163/p/2365569.html
Copyright © 2020-2023  润新知