How to insert Unicode letters (Hindi letters) in SQL Server

beginer
beginer
100 Points
35 Posts

I'm using SQL Server DB to store images and name. Following are the table definition:

CREATE TABLE dbo.Tmp_Image
    (
    Id bigint NOT NULL IDENTITY (1, 1),
    Name varchar(250) NOT NULL,
    Url nvarchar(550) NOT NULL,
    Type varchar(150) NOT NULL
    )

And has collation setting as 'Latin1_General_CI_AI'.

I want to store hindi words (for example 'यूनिकोड हिंदी') in the tmp_image.name but it's storing as '???????'.

Views: 55
Total Answered: 2
Total Marked As Answer: 2
Posted On: 28-Sep-2019 22:57

Share:   fb twitter linkedin
Answers
kikme
kikme
26 Points
8 Posts
         

Use nvarchar and correct collations.

Reference:

Posted On: 01-Oct-2019 10:56
Kjj
Kjj
12 Points
1 Posts
         

Use data types supporting Unicode like:

  • nchar
  • nvarchar
  • ntext

don't use corresponding data types not supporting Unicode: char, varchar, and text, So, 

CREATE TABLE dbo.Tmp_Image
    (
    Id bigint NOT NULL IDENTITY (1, 1),
    Name nvarchar(250) NOT NULL,
    Url nvarchar(550) NOT NULL,
    Type varchar(150) NOT NULL
    )
Posted On: 02-Oct-2019 00:32
thanks..
 - beginer  02-Oct-2019 00:36
 Log In to Chat