search
HomeDatabaseMysql Tutorial除MSSQL数据库text字段中恶意脚本的删方法

删除MSSQL数据库text字段的替换处理示例--全表替换,看到有人提问,所以整理了一个好久以前的处理方法,以供大家参考

方法很简单:text字段不能使用Replace,所以使用patindex
代码如下:
-select * from Product where P_Intro like '%%'
--text字段的替换处理示例--全表替换
-- select datalength(P_Intro),* from Product
--邀月 整理
--定义替换的字符串
declare @s_str nvarchar(4000),@d_str nvarchar(4000)
select @s_str='' --要替换的字符串
,@d_str='' --替换成的字符串


--因为只能用patindex,所以对于搜索字符串做处理
set @s_str='%'+@s_str+'%'

--定义游标,循环处理数据
declare @id bigint
declare #tb cursor for select P_ID from Product where P_Intro like '%%'
-- where P_ID=300727 ----where P_Intro like '%%'
open #tb
fetch next from #tb into @id
while @@fetch_status=0
begin
--字符串替换处理
declare @p varbinary(16)
,@p1 int,@p2 int
,@rplen int,@step int,@len int

select @p=textptr(P_Intro)
,@rplen=len(@s_str)-2
,@step=len(@d_str)
,@p1=patindex(@s_str,P_Intro)
,@len=datalength(P_Intro)
,@p2=0
from Product
where P_id=@id

while @p1>0
begin
set @p2=@p1+@p2-1
updatetext Product.P_Intro @p @p2 @rplen @d_str
select @p2=@p2+1,@p1=patindex(@s_str,substring(P_Intro,@p2+1,@len))
from Product where P_ID=@id
end
fetch next from #tb into @id
end
close #tb
deallocate #tb

--显示结果
---- select datalength(P_Intro),* from Product
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
php怎么连接mssql数据库php怎么连接mssql数据库Oct 23, 2023 pm 12:02 PM

php连接mssql数据库的方法有使用PHP的MSSQL扩展、使用PDO等。详细介绍:1、使用PHP的MSSQL扩展方法,确保PHP安装了MSSQL扩展。可以在PHP配置文件(php.ini)中检查是否启用了mssql扩展;2、使用PDO方法,确保PHP安装了PDO扩展。可以在PHP配置文件(php.ini)中检查是否启用了pdo_sqlsrv扩展。

Ubuntu安装PHP并配置MSSQL连接的详细指南Ubuntu安装PHP并配置MSSQL连接的详细指南Feb 29, 2024 am 11:15 AM

Ubuntu是一款流行的开源操作系统,常用于服务器运行。在Ubuntu上安装PHP并配置MSSQL连接是许多开发者和系统管理员经常需要做的操作之一。本文将为读者提供一份详细的指南,步骤包含安装PHP、设置Apache、安装MSSQLServer等内容,并附上具体的代码示例。第一步:安装PHP及相关扩展首先,我们需要安装PHP及其相关扩展,以便支持PHP连接

Ubuntu环境下安装PHP支持MSSQL数据库的步骤详解Ubuntu环境下安装PHP支持MSSQL数据库的步骤详解Feb 29, 2024 am 10:39 AM

在Ubuntu环境下安装PHP支持MSSQL数据库的步骤详解在开发Web应用程序时,经常会遇到需要连接MicrosoftSQLServer(MSSQL)数据库的情况。在Ubuntu环境下,要实现PHP对MSSQL数据库的连接,需要安装相关的软件以及配置适当的设置。接下来,将详细介绍在Ubuntu环境下安装PHP支持MSSQL数据库的步骤,并提供具体的代码

Ubuntu下安装PHP并连接MSSQL数据库的完整教程Ubuntu下安装PHP并连接MSSQL数据库的完整教程Feb 29, 2024 am 11:18 AM

在Ubuntu操作系统下安装PHP并连接MSSQL数据库是许多开发者和系统管理员所需要掌握的技能之一。本文将提供一个详细的教程,包括安装PHP、安装MSSQL服务器端驱动程序、配置PHP连接MSSQL数据库,并提供相应的代码示例。第一部分:安装PHP首先,我们需要安装PHP及相关的扩展,以便能够连接MSSQL数据库。在终端中输入以下命令来安装PHP及必要的扩

一次mssql注入+白名单上传绕过360的示例分析一次mssql注入+白名单上传绕过360的示例分析May 12, 2023 pm 02:37 PM

信息收集:站点使用vue+aspx+iis8.5搭建。站点登录框有版本号且url栏中存在siteserver字样,因此怀疑是cms搭建的,但未见过该cms,使用谷歌搜索发现该站点是用siteservercms搭建的,版本为最新,且网上提供的漏洞在此无法使用,在登录框尝试过注入+弱口令+验证码绕过+未授权之类等等手段之后无果,由于具有测试的账号,干脆因此直接登录站点进行测试。图示为我从网上查找的登录图片,红框处当时是版本号而非cms提示。功能测试:进入后台之后简单浏览了一下功能,多是一些页面管理的

ubuntu怎么安装php mssqlubuntu怎么安装php mssqlJan 28, 2023 am 09:25 AM

ubuntu安装php mssql的方法:1、进入终端命令窗口;2、执行“curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list”;3、通过install命令安装“pdo_sqlsrv”即可。

Winnti黑客组织MSSQL后门的示例分析Winnti黑客组织MSSQL后门的示例分析May 27, 2023 pm 09:04 PM

一段时间以来,ESET的研究人员一直在跟踪Winnti的活动,该组织从2012年起就开始活跃,并针对视频游戏和软件行业供应链进行攻击。最近,发现了一个以前未经记录的后门,其目标是MicrosoftSQL(MSSQL)。这个后门与PortReuse后门有多处相似之处,PortReuse是WinntiGroup使用的另一个工具,于2019年10月首次记录。今年检测到了一个新后门的样本,skip-2.0,作者是winnti组织成员。这个后门程序以MSSQL服务器11和12为目标,攻击者可以使用magi

Linux系统Apache优化与防盗链详细教程Linux系统Apache优化与防盗链详细教程Feb 20, 2024 am 09:00 AM

以下是关于Linux系统下Apache优化和防盗链的详细教程:Apache性能优化:启用压缩:在Apache配置文件中启用Gzip压缩来减小传输数据的大小。LoadModuledeflate_modulemodules/mod_deflate.soAddOutputFilterByTypeDEFLATEtext/htmltext/plaintext/xmltext/cssapplication/javascript

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),