Persian numbers in SQL Server 2005

不羁的心 提交于 2019-12-07 04:56:26

问题


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?)

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!)

Note: I can't use newer versions of SQL Server...


回答1:


If you insert string literals, be sure to mark Unicode strings with N'', such as

select N'سلام ۱۲۳۴‍‍‍'

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

returns the Unicode values for each character:

1587
1604
1575
1605

I remember that SSMS 2005 had problems displaying certain Unicode ranges in the results window.




回答2:


You Can Use Arabic_CI_AI collation and Solve this problem I hope that help you..



来源:https://stackoverflow.com/questions/11205509/persian-numbers-in-sql-server-2005

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