用bengali langauge对数据类型数据库的sql server [英] Sql server with bengali langauge right data type database

查看:81
本文介绍了用bengali langauge对数据类型数据库的sql server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I know That Bengali is out of official langauge of SQL Server .But I have to Use bengali data For my database .One Way I can use my all of carecter data insert that is Nvarcher Data Type My All of data define Nvarcher datatype . Text, Number all of data if i define Nvarcher datatype then successfully insert .but problem that when i calculate function for number data then not execute  . such as বেনজির is a text data and ২৫৪১ is a number data . So please anyone help me How can i use my bengali data with right data type 





我尝试过:



我试过Nvarcher数据类型使用我的所有文本,数字数据使用。



What I have tried:

I tried Nvarcher data type use my all Text,number data use .

推荐答案

First of所有,请看我对这个问题的评论。使用字符串来表示数字数据是搞砸事情的可靠方法。使用何种书写系统并不重要; 2541也错了。它应该是数字2541,而不是字符串。



但您可能想知道如何将孟加拉语数字字符串解析为数字。 (比方说,你不能改变数据库模式,或者你有其他一些荒谬的理由去做。)我看了孟加拉数字并且,正如我所料,发现它们非常简单。基本上,这是相同的印地语 - 阿拉伯数字,以相同的顺序,在与我们的西方阿拉伯语系统相同的位置系统中使用。只移动角色的代码点。



因此,您可以开发一些函数来解析孟加拉语数字字符串,例如,按照以下简单方法:将每个字符翻译成相应的西方阿拉伯字符串(123 ...) ,可以通过向每个代码点添加固定移位来完成。

Unicode引用告诉我们:'0'的代码点是0x0030;在孟加拉语(0)中为零,代码点为0x09E6(参见 http://www.unicode.org/charts/PDF /U0980.pdf [ ^ ] )。



通过0x09E6 - 0x0030逐个字符转换,然后调用 int.TryParse(string,out int)。让我为你的家庭练习留下复杂的计算。 :-)



我希望将当前的线程文化更改为孟加拉文并使用 TryParse (或<$关于孟加拉语数字字符串的c $ c> Parse )直接无法正常工作。据我了解微软的做法,它适用于仅使用西方阿拉伯数字的文化,但有一些不同的细节,例如不同的组分隔符或小数点。出于好奇,您可以尝试告诉我们它是否有效。我的预测是:它不会。 :-)



-SA
First of all, please see my comment to the question. Using strings to represent numeric data is a sure way to screw up things. It does not matter what writing system to use; "2541" is also wrong. It should be number 2541, not string.

But you may wonder how to parse Bengali numeric strings into numbers. (Let's say, you cannot change database schema, or you have some other ridiculous reasons to do that.) I looked at Bengali numerals and, as I expected, found them extremely simple. Essentially, this is the same Hindi-Arabic numerals, in the same order, used in the same positional system as our Western Arabic system. Only character's code points are shifted.

So, you can develop some function for parsing Bengali numeric string into, say, in the following simple way: translate each character into corresponding Western Arabic string (123…), which can be done by adding fixed shift to each code point.
Unicode reference tells us: code point for '0' is 0x0030; and zero in Bengali (০) has code point 0x09E6 (see http://www.unicode.org/charts/PDF/U0980.pdf[^]).

Do this shift character by character by 0x09E6 − 0x0030, and then call int.TryParse(string, out int). Let me leave the "sophisticated" calculations for your home exercise. :-)

I would expect that changing current thread culture to Bengali and using just TryParse (or Parse) on the Bengali numeric string directly can't work. As I know Microsoft practice, it works on cultures using only Western Arabic numerals, but with some different detail, such as different group separators or decimal point. Out of curiosity, you can try and tell us if it works or not. My prediction is: it won't. :-)

—SA


这篇关于用bengali langauge对数据类型数据库的sql server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆