views:

43

answers:

1

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?

+3  A: 

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.

richardtallent
The character "٢" is numeric. So depending on the IsNumeric() funtion you use, it could/would/should pass.
Ian Boyd