Hyphen vs Dash:用连字符替换Dash

时间:2022-03-28 08:37:53

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)

如果将值复制到SQL Server中。连字符是灰色的,而短划线是黑色但它们看起来完全相同(即不大或小)。问题是我不能写一个REPLACE脚本然后(他们是怪胎一样)

REPLACE ('-' with '-')

用。。。来代替 '-')

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

有没有办法在SQL服务器中识别像破折号这样的特殊字符?

SQL Server v 2005

SQL Server v 2005

1 个解决方案

#1


9  

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

您可以使用NCHAR(8211)作为短划线,或使用NCHAR(8212)作为短划线。

#1


9  

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

您可以使用NCHAR(8211)作为短划线,或使用NCHAR(8212)作为短划线。