Search code examples
sql-serversql-server-2008sql-server-2000internationalizationlocale

SQL Server: Must numbers all be specified with latin numeral digits?


Does SQL server expect numbers to be specified with digits from the latin alphabet, e.g.:

0123456789

Is it valid to give SQL Server digits in other alphabets?

Rosetta Stone:

Latin:   01234567890
Arabic:  ٠١٢٣٤٥٦٧٨٩
Bengali: ০১২৩৪৫৬৭৮৯

i know that the client (ADO) will convert 8-bit strings to 16-bit unicode strings using the current culture. But the client is also converting numbers to strings using their current culture, e.g.:

SELECT * FROM Inventory
WHERE Quantity > ২৩৪,৭৮

Which throws SQL Server for fits.

i know that the server/database has it's defined code page and locale, but that is for strings.

Will SQL Server interpret numbers using the active (or per-login specified) locale, or must all numeric values be specifid with latin numeral digits?


Solution

  • From what I can tell, T-SQL requires latin digits, and decimal points specified as ..

    Neither ISNUMERIC() nor CAST() can successfully test these digits, so a numeric constant using those characters would not work either.

    Allowing a client to pass non-Latin digits sounds dangerously promiscuous (I'm not sure what path your data travels, but there seems to be a potential for SQL injection if user's localized input isn't being tested to be numeric.