转:https://blog.youkuaiyun.com/u010195563/article/details/82927984
---如下是查询语句
--查询名称有退格键
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

本文详细介绍了如何在SQL中查询包含特殊字符的数据,包括退格键、制表符、换行、回车、空格、单引号及双引号等,通过具体SQL语句示例,帮助读者掌握复杂条件下的数据检索方法。
989

被折叠的 条评论
为什么被折叠?



