Hyphen vs Dash : Replace Dash with Hyphen

时光毁灭记忆、已成空白 提交于 2019-12-01 01:41:52

问题


Alright so we had a problem recently

In reporting services some of the String Columns were appearing as gibberish Chinese characters.

On further investigation we found it is the hyphen. Well that's what we though first. On further investigation we found it a dash (or en dash) . Basically the reason this has happened is people copy pasting values into this column from word which converts hyphens into dashes automatically.

But if you look at the database they both look the same. Though on the application side you can see the difference.

How do I replace the dash with a normal hyphen.

If you copy the value in put it in SQL server. A hyphen is gray while a dash is black but they both look exactly the same (i.e not bigger or smaller). Problem is I can't write a REPLACE script then (they are the freakin same)

REPLACE ('-' with '-')

is there a way special characters like the dash can be identified in SQL server?

SQL Server v 2005


回答1:


You can use NCHAR(8211) for the en dash, or NCHAR(8212) for em dash.



来源:https://stackoverflow.com/questions/2785805/hyphen-vs-dash-replace-dash-with-hyphen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!