SQL Server 2005 中的波斯数字 [英] Persian numbers in SQL Server 2005
问题描述
我正在尝试向我的 SQL Server 2005 数据库添加一些波斯文本.
I'm trying to add some persian text to my SQL Server 2005 database.
字母没有问题,但是波斯数字(۱،۲،۳،...
)转换为?
...
There is no problem with letters, but persian numbers (۱،۲،۳،...
) are converted to ?
...
例如,如果我将此文本 (سلام ۱۲۳۴
) 添加到数据库中,则数据库中将有 (سلام ؟؟؟؟
)/
For example, if I add this text (سلام ۱۲۳۴
) to database, there will be (سلام ؟؟؟؟
) in database/
我该怎么办?(例如,我应该使用哪种排序规则?)
What should I do? (for example, which collation should I use?)
我正在使用 Arabic_CI_AS
整理.在这个列表中,波斯语(波斯语)整理是阿拉伯语_CI_AS
(SQL Server 2005 没有 Persian
排序规则,但 2008 有!)
I'm using Arabic_CI_AS
collation. in this list, Farsi (Persian) collation is Arabic_CI_AS
(SQL Server 2005 doesn't have Persian
collation, but 2008 has!)
注意:我不能使用较新版本的 SQL Server...
Note: I can't use newer versions of SQL Server...
推荐答案
如果插入字符串字面量,一定要用 N'' 标记 Unicode 字符串,如
If you insert string literals, be sure to mark Unicode strings with N'', such as
select N'سلام ۱۲۳۴'
接下来确定问号是否只是SSMS中的一个显示问题:
Next, make sure whether the question marks are only a display problem in SSMS:
declare @t nvarchar(50) = N'سلام ۱۲۳۴'
select unicode(substring( @t, 1, 1))
select unicode(substring( @t, 2, 2))
select unicode(substring( @t, 3, 3))
select unicode(substring( @t, 4, 4))
返回每个字符的 Unicode 值:
returns the Unicode values for each character:
1587
1604
1575
1605
我记得 SSMS 2005 在结果窗口中显示某些 Unicode 范围时出现问题.
I remember that SSMS 2005 had problems displaying certain Unicode ranges in the results window.
这篇关于SQL Server 2005 中的波斯数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!