sqlserver 中含有某字符串
查找 sqlserver 中字符串的ascii码
SET TEXTSIZE 0
-- Create variables for the character string and for the current
-- position in the string.
DECLARE @position int, @string char(8)
-- Initialize the current position and the string variables.
SET @position = 1
SET @string = '—销售定转子冲片及转子齿压板等(北京三一)'
WHILE @position <= DATALENGTH(@string)
BEGIN
SELECT ASCII(SUBSTRING(@string, @position, 1)),
CHAR(ASCII(SUBSTRING(@string, @position, 1)))
SET @position = @position + 1
END
GO
发现特殊字符char(31),单元间隔符
查找sqlserver中是否含有该特殊字符
两种方案
select * from GL_accvouch where cdigest like '%'+ char(31)+'%'
select * from GL_accvouch where CHARINDEX(CHAR(31),cdigest)<>0
或者使特殊字符显示出来
select REPLACE(cdigest,char(31),'xx'),* from gl_accvouch
最后替换特殊字符
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步