Friday, May 15, 2020

SQL SERVER : Store Multilingual (Hindi, Japanese etc.) data in Table

Here in this article I am going to explain how we can store the multilingual (Hindi, Japanese etc.)  data in SQL SERVER table.

 When working on an application get requirement to store the data of other language than English (multilingual) in database. If you have get any such requirement, you can achieve this following two things:

1. Set Unicode compatible datatype (ntext, nvarchar, nchar) for table column

2. Use N (capital) as a prefix before inserting data/text

 

Example :

First of all, create a table. I have created table to store admin users name.

Create table tblAdmin (
EnglishName NVARCHAR(100),
HindiName nchar(100),
JapaneseName ntext
)

 

Now insert data into table.

insert into tblAdmin(EnglishName,HindiName,JapaneseName) values(N'Vijay Saklani',N'विजय सकलानी',N'ビジェイ・サクラニ')

 Get the data from table and check the saved data.

Select * from tblAdmin

 

how we can store the multilingual (Hindi, Japanese etc.)  data in SQL SERVER table

If you will insert the into table without prefix N, data will not be useful. It will be inserted in question mark (????) form and become garbage. Let’s check with this also:

insert into tblAdmin(EnglishName,HindiName,JapaneseName) values('Vijay Saklani','विजय सकलानी','ビジェイ・サクラニ')

 Check the inserted data now. 

 how we can store the multilingual (Hindi, Japanese etc.)  data in SQL SERVER table



No comments:

Post a Comment