zoukankan      html  css  js  c++  java
  • ntext replace sql

    create       table       test(id       int       identity(1,1),content       ntext)        
          insert       test       values(N'asdfsdfasdfsadfsdjflk大力sdjflkasjdf;lasdjf;lafsd')        
          insert       test       values(N'fdsgdsfgdfgsdfghrtjtyjkhkhjkhjljk大力ljk;jk;kl;kl;kl;')        
          go        
               
          create       proc       替换        
          @s_str       varchar(100),        
          @d_str       varchar(100)        
          as        
          declare       @id       int        
          declare       #tb       cursor       for       select       id       from       test        
          open       #tb        
          fetch       next       from       #tb       into       @id        
          while       @@fetch_status=0        
          begin        
                  declare       @p       varbinary(16),@postion       int,@rplen       int        
                  select       @p=textptr(CONTENT),@rplen=len(@s_str),@postion=charindex(@s_str,CONTENT)-1       from       test       where       id=@id        
                  while       @postion>0        
                          begin        
                                  updatetext       test.CONTENT       @p       @postion       @rplen       @d_str        
                                          select       @postion=charindex(@s_str,content)-1       from       test       where       id=@id        
                          end        
                  fetch       next       from       #tb       into       @id        
          end        
          close       #tb        
          deallocate       #tb        
          go        
               
          exec       替换       '大力','AAAAA'        
               
          go        
               
          select       *       from       test        
               
          go        
          drop       table       test        
  • 相关阅读:
    2019 web安全基础知识学习
    nc语法和nc木马远程控制主机
    公钥、私钥、hash、数字签名、CA以及验证过程
    A5/1流加密理解和算法实现
    TCP/IP和OSI/RM以及协议端口
    【转】TCP/IP网络协议各层首部
    校园网 虚拟机VMware Linux桥接模式 无法上网 问题
    本地远程查看服务器tomcat 上虚拟机信息
    跨域访问的解决
    混合调用tk.mybatis.mapper 与 自编xml文件 的配置
  • 原文地址:https://www.cnblogs.com/flyfish/p/1444877.html
Copyright © 2011-2022 走看看