SQL Server:所有数字都必须用拉丁数字指定吗? [英] SQL Server: Must numbers all be specified with latin numeral digits?
问题描述
SQL Server是否希望使用拉丁字母中的数字来指定数字,例如:
Does SQL server expect numbers to be specified with digits from the latin alphabet, e.g.:
0123456789
以其他字母提供SQL Server数字是否有效?
Is it valid to give SQL Server digits in other alphabets?
罗塞塔·斯通:
Latin: 01234567890
Arabic: ٠١٢٣٤٥٦٧٨٩
Bengali: ০১২৩৪৫৬৭৮৯
我知道客户端(ADO)将使用当前区域性将8位字符串转换为16位unicode字符串.但是客户也正在使用其当前的区域性将数字转换为字符串,例如:
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 > ২৩৪,৭৮
哪个适合SQL Server.
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.
SQL Server将使用活动(或指定的每个登录名)区域设置来解释数字,还是必须用拉丁数字指定所有数字值?
Will SQL Server interpret numbers using the active (or per-login specified) locale, or must all numeric values be specifid with latin numeral digits?
推荐答案
据我所知,T-SQL需要拉丁数字和指定为.
的小数点.
From what I can tell, T-SQL requires latin digits, and decimal points specified as .
.
ISNUMERIC()和CAST()都不能成功测试这些数字,因此使用这些字符的数字常量也将不起作用.
Neither ISNUMERIC() nor CAST() can successfully test these digits, so a numeric constant using those characters would not work either.
允许客户端传递非拉丁数字听起来很危险(我不确定您的数据通过的路径,但是如果未测试用户的本地化输入是否为数字,则似乎存在SQL注入的可能性.
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.
这篇关于SQL Server:所有数字都必须用拉丁数字指定吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!