SQL:在VARCHAR中存储扩展ASCII(128至255) [英] SQL: Storing Extended ASCII (128 to 255) in VARCHAR
问题描述
如何在VARCHAR中存储128到255个字符??
How do you store chars 128 to 255 in VARCHAR..?
SQL似乎将其中一些更改为char(63)'?'.我不确定是否与归类有关? UTF-8? N'..'?我已经尝试过COLLATE Latin1_General_Bin,但是不确定它是否支持扩展的ascii.
SQL seems to change some of these to char(63) '?'. I'm not sure if it's something to do with collation? UTF-8? N'..'? I've tried COLLATE Latin1_General_Bin, not sure if it supports extended ascii though..
显然可以与NVARCHAR一起使用,但是从理论上讲,它也可以在VARCHAR中使用..
Obviously works with NVARCHAR, but in theory this should work in VARCHAR too..?
推荐答案
存储在varchar/char列中超出ASCII 0-127字符范围的字符由与归类相关联的代码页确定.代码页中未明确定义的字符被以太映射为相似的字符,如果没有,则映射为?".
The character stored in varchar/char columns beyond the ASCII 0-127 character range is determined by the code page associated with the collation. Characters not specifically defined by the code page are ether mapped to a similar character or, when there is none, '?'.
您可以使用此查询列出归类以及相关的代码页:
You can list collations along with the associated code page with this query:
SELECT name, description, COLLATIONPROPERTY(name, 'CodePage') AS CodePage
FROM fn_helpcollations();
这篇关于SQL:在VARCHAR中存储扩展ASCII(128至255)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!