简体   繁体   中英

Removing special characters in sql

I am new to SQL and just know basic insert, update, and delete syntax.

I have an excel file, that I imported into the SQL server, but somehow, it brought in weird symbols and characters.

When I checked the excel file ,cleared all formatting, and re-uploaded, it would still show up, not sure how to clean it up.

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:

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' ');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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