SQL查询和替换含有回车,空格,TAB,等
2024-09-17 14:26:10
---如下是查询语句
--查询名称有退格键
select * from t_bd_item_info where charindex(char(8),item_name) > 0
go --查询名称有制表符tab
select * from t_bd_item_info where charindex(char(9),item_name) > 0
go
--查询名称有换行
select * from t_bd_item_info where charindex(char(10),item_name) > 0
go
--查询名称有回车
select * from t_bd_item_info where charindex(char(13),item_name) > 0
go
--查询名称的空格(前空格、后空格、所有空格)
select * from t_bd_item_info where isnull(charindex(' ',item_name),0) > 0
go
--查询名称的单引号
select * from t_bd_item_info where charindex(char(39),item_name) > 0
go
--查询名称的双单引号
select * from t_bd_item_info where charindex(char(34),item_name) > 0
go --处理名称有退格键
update t_bd_item_info set item_name = replace(item_name,char(8),'')
where charindex(char(9),item_name) > 0
go --处理名称有制表符tab
update t_bd_item_info set item_name = replace(item_name,char(9),'')
where charindex(char(9),item_name) > 0
go
--处理名称有换行
update t_bd_item_info set item_name = replace(item_name,char(10),'')
where charindex(char(10),item_name) > 0
go
--处理名称有回车
update t_bd_item_info set item_name = replace(item_name,char(13),'')
where charindex(char(13),item_name) > 0
go
--处理名称的空格(前空格、后空格、所有空格)
update t_bd_item_info set item_name = replace(rtrim(ltrim(item_name)),' ','')
where isnull(charindex(' ',item_name),0) > 0
go
--处理名称的单引号
update t_bd_item_info set item_name = replace(item_name,char(39),'')
where charindex(char(39),item_name) > 0
go
--处理名称的双单引号
update t_bd_item_info set item_name = replace(item_name,char(34),'')
where charindex(char(34),item_name) > 0
go
最新文章
- 基于Spring Mvc实现的Excel文件上传下载
- iOS 整理笔记 获取手机信息(UIDevice、NSBundle、NSLocale)
- Sass中文乱码问题(手动编译和watch编译)
- 今天说一下Order by 这个常规东西~
- 解析nginx负载均衡
- 利用http协议实现图片窃取
- [置顶] Codeforces Round #198 (Div. 1)(A,B,C,D)
- 自定义checkbox样式
- 原 iOS面试题收集
- Sql Server 循环添加日期--(累加到一个字段中)
- .NET对象占内存多少
- JavaScript 中常见设计模式整理
- java基础系列之ConcurrentHashMap源码分析(基于jdk1.8)
- WDS和DHCP配置说明
- Android-TextView 控件常用属性以及基本用法
- Select2日常操作集合
- sql server中的charindex函数用法解析(在一段字符中搜索字符或者字符串-----返回expression1在expression2出现的位置;反之,返回0)
- c# 数字之间的计算
- Android返回系统Home桌面
- 练习1 Just Java