Вопрос

Does anyone know of a simple chart or list that would show all acceptable varchar characters? I cannot seem to find this in my googling.

Это было полезно?

Решение

What codepage? Collation? Varchar stores characters assuming a specific codepage. Only the lower 127 characters (the ASCII subset) is standard. Higher characters vary by codepage.

The default codepage used matches the collation of the column, whose defaults are inherited from the table,database,server. All of the defaults can be overriden.

In sort, there IS no "simple chart". You'll have to check the character chart for the specific codepage, eg. using the "Character Map" utility in Windows.

It's far, far better to use Unicode and nvarchar when storing to the database. If you store text data from the wrong codepage you can easily end up with mangled and unrecoverable data. The only way to ensure the correct codepage is used, is to enforce it all the way from the client (ie the desktop app) to the application server, down to the database.

Even if your client/application server uses Unicode, a difference in the locale between the server and the database can result in faulty codepage conversions and mangled data.

On the other hand, when you use Unicode no conversions are needed or made.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top