Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using unicode text in sql server 2008

I want to use unicode text in my site. I have nvarchar(max) data type in database to store the data. When I save unicode text into database, it works fine. However when i try to perform some sql operation the unicode text is changed to "?????" Eg, the query below

declare @unicodetext nvarchar(250)
set @unicodetext='बन्द'
select @unicodetext

results

sqlunicode

What is the solution for this? Thanks

like image 668
Paras Avatar asked May 10 '12 08:05

Paras


People also ask

Does SQL Server support Unicode?

SQL Server has long supported Unicode characters in the form of nchar, nvarchar, and ntext data types, which have been restricted to UTF-16.

How do I select Unicode in SQL Server?

SQL Server UNICODE() Function The UNICODE() function returns an integer value (the Unicode value), for the first character of the input expression.

What is Unicode data type in SQL Server?

UNICODE is a uniform character encoding standard. A UNICODE character uses multiple bytes to store the data in the database. This means that using UNICODE it is possible to process characters of various writing systems in one document.


1 Answers

Try

declare @unicodetext nvarchar(250)
set @unicodetext = N'बन्द'
select @unicodetext

Maybe you noticed that SQL Server uses N to any quoted string input when generating DDL scripts for you.

like image 57
Filburt Avatar answered Sep 24 '22 14:09

Filburt