我试图在 SQL 2008 数据库中存储阿拉伯字符串,但它转换为问号",为什么?我该怎么办?
您需要为 varchar/char 列选择阿拉伯语排序规则或使用 Unicode (nchar/nvarchar)
创建表#test(col1 VARCHAR(100) COLLATE Latin1_General_100_CI_AI,col2 VARCHAR(100) 整理阿拉伯语_CI_AI_KS_WS,col3 NVARCHAR(100))INSERT INTO #test VALUES(N' ',N' ',N' ')
<块引用>
注意上面插入语句中的 N 之前的值.如果不提及,系统会将这些值视为 Varchar,而不是 NVarchar.
SELECT * FROM #test
退货
col1 col2 col3------------------------------ ------------------------------- ------------------------------??????????????
要查看阿拉伯语排序列表,请使用
SELECT 名称、描述FROM fn_helpcollations()WHERE name LIKE 'Arabic%'
I tried to store Arabic string in SQL 2008 database but it converted to " question mark " why ? and what should I do ?
You need to choose an Arabic collation for your varchar/char columns or use Unicode (nchar/nvarchar)
CREATE TABLE #test
(
col1 VARCHAR(100) COLLATE Latin1_General_100_CI_AI,
col2 VARCHAR(100) COLLATE Arabic_CI_AI_KS_WS,
col3 NVARCHAR(100)
)
INSERT INTO #test VALUES(N' ',N' ',N' ')
Note the N before values in insert statement above. If you do not mention it, system will treat the values as Varchar, not NVarchar.
SELECT * FROM #test
Returns
col1 col2 col3
------------------------------ ------------------------------ ------------------------------
?? ????? ???????
To see a list of Arabic collations use
SELECT name, description
FROM fn_helpcollations()
WHERE name LIKE 'Arabic%'
这篇关于在 SQL 数据库中存储阿拉伯语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!