sql字符编码非英文字符

标签 sql sql-server-2008 encoding character-encoding sql-insert

我正在使用 sql 2008 r2 我正在尝试用阿拉伯语插入一些值

insert into tbl_number (number_ownerName , number_num ) values ('مديرية الزراعة/التقانة','235767')
insert into tbl_number (number_ownerName , number_num) values ('محمد  راتب ابازيد','227927')
insert into tbl_number (number_ownerName , number_num) values ('فادي مصطفى ابازيد','221355')

但结果看起来像:

select * from tbl_number
number_num            number_ownerName 
235767          ?????? ???????/??????? 
227927                  ????  ???? ??????    
221355                  ???? ????? ??????     

最佳答案

我认为您正在寻找 NCHAR 这是 NATIONAL CHAR,存储为 UTF-16LE,是可靠存储非 ASCII 字符的唯一方法。

Fixed-length Unicode string data. n defines the string length and must be a value from 1 through 4,000. The storage size is two times n bytes. When the collation code page uses double-byte characters, the storage size is still n bytes. Depending on the string, the storage size of n bytes can be less than the value specified for n. The ISO synonyms for nchar are national char and national character..

另请注意,SQL Server 不支持 UTF-8。

另请检查

编辑:-

正如评论所述,您可以在插入时添加 N。尝试这样:

insert into tbl_number (number_ownerName , number_num ) values (N'مديرية الزراعة/التقانة','235767') 
insert into tbl_number (number_ownerName , number_num) values (N'محمد راتب ابازيد','227927') 
insert into tbl_number (number_ownerName , number_num) values (N'فادي مصطفى ابازيد','221355')

关于sql字符编码非英文字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20438922/

相关文章:

sql - 数据库的事务日志已满

Node.js Cheerio 解析器破坏了 UTF-8 编码

html - img标签的alt属性是否需要编码?

mysql - 动态自引用多对多关系

sql - 创建从 VIEW 中选择的 VIEW

c# - 将 doc 文件插入 SQL Server 中的列

tsql - SQL DateDiff Weeks - 需要和替代

android - Nv21字节数据在android中保存为彩色H264格式

java - SQL Integrity Constraint Violation异常如何解决

mysql - SQl查询连接具有相同ID但具有相同日期字段的不同值的多行