SQL Server 2008 & International Currencies
An application that I've built is used worldwide by our organization and needs to support several different currencies. SQL Server was doing fine with the 'normal' stuff i.e. the GBP symbol, Euro symbol, but when I introduced the symbol for the Saudi Riyal (ريال SAR), it stores it as question marks.
Client-side is 开发者_Go百科100% jQuery/javascript working with REST-enabled WCF services.
I ran across something talking about the LocaleID here
Hoping someone can shed some light on this.
Format your strings as nVarchar
. If they are in fields in a table, change the datatype. If they are just formatted on the fly, use the N
prefix. nVarchar
is unicode, which is an expanded international character set.
Example:
SELECT 'ريال'
select N'ريال'
On my system, the first shows ????
, the second shows the symbol correctly.
EDIT
If the characters were entered as varchar
you will still have issues.
See example below:
DECLARE @t nvarchar(10) = N'ريال'
DECLARE @x nvarchar(10) = 'ريال'
SELECT @t
SELECT @x
精彩评论