Unicode data type in SQL

I am new to Microsoft SQL. I plan to store text on a Microsoft SQL server, and there will be special international characters. Is there a "Data Type" specific to Unicode, or am I better encoding my text with reference to the unicode number (i.e. \ U0056)

+3
source share
4 answers

Use Nvarchar/ Nchar( MSDN link ). There used to be a data type Ntext, but now it has depreciated in favor Nvarchar.

Columns take up twice as much space as non-Unicode counterparts ( charand varchar).

Then, when "manually" inserted into them, use Nto specify text in unicode:

INSERT INTO MyTable(SomeNvarcharColumn) 
VALUES (N'franΓ§ais')
+11

, ? , nvarchar .

Unicode, , , .

( ), , , , Unicode nvarchar, . Unicode .

, ASCII, , UTF-8 HTML- varchar. 932 ( ), varchar, . , , DBCS, "". , , .

, nvarchar - , .

, , :

?

?

NULL?

?

- , , ?

+5

, Unicode .

INSERT INTO <table> (text) values (N'<text here>)

1

+2

The character set functions for tables and the rows inside them are specified for the database, and if your database has Unicode sorting, the rows inside the tables are Unicode. Also, for string columns, you must use data types nvarcharor ncharso that they can store Unicode strings. But this function works if your database has utf8 or unicode character set or sort. Read this link for more information. Unicode and SQL Server

0
source

All Articles