简体   繁体   English

从SQL比较中排除隐藏字符

[英]Exclude hidden characters from SQL comparison

I want to search within a column where some rows has hidden characters. 我想在其中某些行具有隐藏字符的列中进行搜索。 When I use = operator there is no result: 当我使用=运算符时,没有结果:

SELECT * 
FROM result 
WHERE destination = 'x'

and when I use like operator the result are more than what I expect in = operator. 当我使用like运算符时,结果超出了我在=运算符中的预期。

SELECT * 
FROM result 
WHERE destination LIKE '%x%'

I guess the reason that = operator has no result is because I have originally converted an Excel file to a Microsoft Access .MDB database file and there are some hidden characters in data columns (I have no idea what are those hidden characters). 我猜想=运算符没有结果的原因是因为我最初将Excel文件转换为Microsoft Access .MDB数据库文件,并且数据列中有一些隐藏字符(我不知道这些隐藏字符是什么)。

How can I exclude all hidden characters from columns when I compare them to x? 将它们与x进行比较时,如何从列中排除所有隐藏的字符? is there a complete list of hidden characters so I can use replace function? 有隐藏字符的完整列表,以便可以使用replace功能吗?

If the hidden characters are whitespace, you should be able to use something like 如果隐藏的字符为空格,则应该可以使用类似

Trim(destination) ='x'

However what you most certainly should do is fix the data so no hidden chars are there, else you would run into all kinds of unexpected problems later on. 但是,您最肯定应该做的是修复数据,以确保没有隐藏的字符,否则以后您将遇到各种意外问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM