Hebrew and other languages ​​in sql

I have SQL Server hosting, clients are mobile applications.

I have the logic that the user creates the data and stores it on the server. Some data is text. However, the user can enter English, Hebrew, or any other languages ​​supported by his client.

What sorting should I specify in the tables to support all languages?

Yoav Relations

+4
source share
2 answers

you need to save it as nvarchar and don't forget the text prefix with N

Example

declare @n nchar(1) set @n = N'ζ–‡' select @n GO declare @n nchar(1) set @n = 'ζ–‡' select @n 

Exit

 ----ζ–‡(1 row(s) affected) ---- ? (1 row(s) affected) 

The N in front of the string value tells SQL Server to treat it as unicode, note that you are returning a question mark when you are not using N?

From a search perspective, take a look at Unicode Performance Impact, Equals vs LIKE and Partially Filled Fixed Width

+2
source

When creating a table, you should use nchar instead of char and nvarchar instead of varchar .

+1
source

Source: https://habr.com/ru/post/1402119/


All Articles