Wednesday, 20 November 2013

Saving Chinese ,Hindi ,Marthi or any string in SQL Server?

  Please go through script for inserting character other than english.I will explain with queries.
  go
 create table #sk_Import(Name nvarchar(max))
 go
 insert into #sk_Import values ('मेरा नाम श्रीकांत है')
 go
 select Name  from #sk_Import
 go
            Above query will create table,It will insert value and finally it will show output.
But it will show  '? '  and value which we have inserted.

Solution :
   1. Delete all data .        
delete from #sk_Import
 go
 insert into #sk_Import values (N'मेरा नाम श्रीकांत है')
 go
 select Name  from #sk_Import

  Now data is inserted and it will show correct output .Means it will show us value (Not ' ? ')

Note : We have used N as prefixed.Where  'N' stands for representing unicode characters.

No comments:

Post a Comment