SQL SERVER – Storing Data in Hindi, Chinese, Gujarati and Tamil (or any other) Language in the Same Table

Long time ago, I have written a blog which talks about multi language support available with SQL Server.

SQL SERVER – 2005 – Multiple Language Support

I have been getting below questions on regular basics and it still baffles me:

  1. How do I pass Hindi parameters in SQL Server procedure as I want to insert a row with Hindi text?
  2. What is the collation I need to use if I have to store Tamil in SQL Server tables?
  3. I am inserting the data in Gujarati but while selecting I am getting “???”

Here are some basic rules which you may want to keep in mind. While storing Unicode data, the column must be of Unicode data type (nchar, nvarchar, ntext). Another rule is that the value must be prefixed with N while insertion.

If you are using a stored procedure then while passing the parameter to stored procedure make sure that N is used before the string. Also make sure the parameter declared within the stored procedure which are used for carrying those variable are also defined as Unicode.

Here is the sample script and the output which can make sure understand the things. I have used Google translate to do translation and I am not sure how accurate it is in Kannada, Tamil and Telugu.

use master
go
If db_id('SQLAuthority') is not null
drop database SQLAuthority
go
set nocount on
go
Create database SQLAuthority
go
use SQLAuthority
go
Create Table MultiLanguage_Will_Not_Work (i int, j varchar(10), k varchar(100))
go
-- Hindi
Insert into MultiLanguage_Will_Not_Work values (1, 'with N', N'मेरा नाम Pinal है')
go
-- Tamil
Insert into MultiLanguage_Will_Not_Work values (2, 'without N', 'என் பெயர் PINAL ஆகிறது')
go
Select * from MultiLanguage_Will_Not_Work
go
Create Table MultiLanguage (i int,j varchar(10), k nvarchar(100))
go
-- Gujarati
Insert into MultiLanguage values (1, 'with N', N'મારું નામ પિનલ છે')
go
-- Telugu
Insert into MultiLanguage values (2, 'without N', 'నా పేరు PINAL ఉంది')
go
-- Kannada
Insert into MultiLanguage values (3, 'with N', N'ನನ್ನ ಹೆಸರು ಪಿನಾಲ್ ಆಗಿದೆ')
go
Select * from MultiLanguage
go
use master
go
drop database SQLAuthority
go

Here is the output

SQL SERVER - Storing Data in Hindi, Chinese, Gujarati and Tamil (or any other) Language in the Same Table unicode-01

Same would work for any language as well. It is important for us to know the basics and this blog post is one of many basics blogs that I plan to write. Do let me know which topic you would like me to revisit as part of this – back to basics series? More ideas you give me, more interesting the series can be.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Collation
Previous Post
SQL SERVER – Configure, Monitor and Restore Backups from Mobile & Web browser
Next Post
Hey DBA – Protecting a Proactive Attitude – Notes from the Field #069

Related Posts

41 Comments. Leave new

  • Hi Pinal,

    I regularly visit your blogs. I found many important things many times. Is there a way to create language converter function in sql server?
    example :
    select dbo.spanish(‘english’)

    Reply
  • Thx alot sir

    Reply
  • Hi
    Pinal

    Not working Tamil font in your insert Query
    can you update?

    Reply
    • You should use like this

      Insert into MultiLanguage_Will_Not_Work values (2, ‘without N’, N’என் பெயர் PINAL ஆகிறது’)-

      Reply
  • Good one…sir

    Reply
  • Dhruvi Patel
    June 9, 2020 5:06 pm

    can you help me to find chinese characters data from table.?

    Reply
  • Vinayak Joshi
    July 26, 2020 2:49 pm

    Hello Pinal,

    below ismy query. i want heading in gujarati. can you please help me.

    declare @Query1 varchar(max)
    SET @Query1 =’
    select ReferenceNo as ‘N’આવક સંદર્ભ”
    from GovernmentReferenceDashboard where 1=1’
    print (@Query1)
    exec (@Query1)

    Thaanks.

    Reply
  • I want to search a table and retrieve the records where there’s hindi content how do I do that ?

    Reply

Leave a Reply