问题描述
据我所知,整理可以在数据库中不同的表,设置不同。排序规则是由What确实字符集和校对规则意味着什么?
有执行 CAST
从一个字符效果如下图所示的查询。有没有涉及到的表。我猜想,申请编码将根据在数据库级别的排序规则。难道这个假设是正确的?
SELECT CAST(SSS.id_encrypt('E','0000000 {0})AS CHAR(100)位数据)
AS ENCRYPT_ID从FFGLOBAL.ONE_ROW FETCH FIRST 1 ROW ONLY
问
在问题获取字节[]从DB2中没有编码给出了答案通过@AlexFilipovici [净 BlockCopy
]相比, CAST
的结果提供了一个不同的结果。为什么会这样,如果没有 codePAGE
相关?
href="http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Fc0004123.htm"相对=nofollow>国家语言支持 - 字符转换
参考
- 获取字节[]从DB2中没有编码
- <一个href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.wn.doc%2Fdoc%2Fi0052421.html"相对=nofollow>新数据库的默认code页面统一code
- <一个href="http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.udb.admin.doc%2Fdoc%2Fc0004123.htm"相对=nofollow>国家语言支持 - 字符转换
要回答你的问题:
#1:指定 FOR BIT DATA
亮(DB2)基于字符的数据类型,意味着DB2存储/返回原始数据传回没有codePAGE相关的(也就是说,它的字节只是一个字符串,不会通过客户端和服务器之间的任何codePAGE转换)。
#2:在DB2用于Linux,UNIX和Windows中,可以通过查询确定数据库的归类 SYSIBMADM.DBCFG
选择名称,值
从sysibmadm.dbcfg
凡在('codePAGE','codeSET)的名称;
3:每@Iswanto三:
SELECT DATABASEPROPERTYEX('数据库名称','整理');
I understand that collation can be set differently in different tables in a database. Collation is understood from What does character set and collation mean exactly?
There is a query that performs CAST
from a char results as shown below. There are no tables involved. I guess, the encoding applied will be based on the collation in database level. Is this assumption correct?
SELECT CAST ( SSS.id_encrypt ('E','0000000{0}') AS CHAR(100) FOR BIT DATA)
AS ENCRYPT_ID FROM FFGLOBAL.ONE_ROW FETCH FIRST 1 ROW ONLY
QUESTION
In the question Get Byte[] from Db2 without Encoding answer given by @AlexFilipovici [.Net BlockCopy
] provides a different result when compared to CAST
result. Why is it so if there is no codepage
associated?
Based on National language support - Character conversion
REFERENCE
- Get Byte[] from Db2 without Encoding
- Default code page for new databases is Unicode
- National language support - Character conversion
To answer your questions:
#1: Specifying FOR BIT DATA
on a character-based data type (in DB2) means that DB2 stores / returns the raw data back with no codepage associated (i.e. it's just a string of bytes and will not go through any codepage conversion between client and server).
#2: In DB2 for Linux, UNIX and Windows, you can determine the database's collation by querying SYSIBMADM.DBCFG
select name,value
from sysibmadm.dbcfg
where name in ('codepage','codeset');
#3: Per @Iswanto San:
SELECT DATABASEPROPERTYEX('databasename', 'Collation');
这篇关于净BlockCopy和DB2字符转换使用codePAGE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!