简体   繁体   English

在SQL中删除特殊字符

[英]Removing special characters in sql

I am new to SQL and just know basic insert, update, and delete syntax. 我是SQL的新手,只知道基本的插入,更新和删除语法。

I have an excel file, that I imported into the SQL server, but somehow, it brought in weird symbols and characters. 我有一个导入到SQL Server中的excel文件,但是以某种方式,它引入了奇怪的符号和字符。

When I checked the excel file ,cleared all formatting, and re-uploaded, it would still show up, not sure how to clean it up. 当我检查excel文件,清除所有格式并重新上传时,它仍然会显示,不确定如何清除它。

Is there an easy replace syntax that you can suggest for me to use to do a global cleanup? 您是否可以建议我使用一种简单的替换语法来进行全局清理?

Sample values inside the columns are: 列内的样本值是:

Lisa Hettinger  Cherry Creek Prop
Lisa J Hernandez

I would need to remove the weird and á characters. 我需要删除奇怪的á字符。

If all you have are the "┬á" characters, you can try using the REPLACE command like this: 如果所有字符都是“┬á”字符,则可以尝试使用REPLACE命令,如下所示:

SELECT REPLACE(N'Lisa J Hernandez', N' ', N' ')

I suspect the source code page has "┬á" as its space character. 我怀疑源代码页面的空格字符为“┬á”。

Update: To update the values in the entire column, you can use 更新:要更新整个列中的值,可以使用

UPDATE [MyTableName] SET [MyColName] = REPLACE([MyColName], N' ', N' ');

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

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