存档

文章标签 ‘inttohex’,文章数:1

Sybase IQ和ASE中都有函数ascii,返回字符串表达式中第一个字节的整数 ASCII 值!

那么, 如何获得字符串的十六进制形式呢?

比如:以GBK编码的三个汉字“数据库”的十六进制形式为:0xcafdbeddbfe2

可以验证一下: select char(hextoint('ca')) + char(hextoint('fd')) , char(hextoint('be')) + char(hextoint('dd')),char(hextoint('bf')) + char(hextoint('e2'))

本文提供两种方法,主要涉及到的函数有: substring,ascii,inttohex,right,list,string以及sa_rowgenerator系统过程。