I don't know of a built in function or format, but a UDF can be written to do that (5.1 and above):---------------------------------------------------------------#define SQL_TEXT Latin_Text#include "sqltypes_td.h"/* CREATE statement: REPLACE FUNCTION char2int(VARCHAR(1)) RETURNS BYTEINT LANGUAGE C NO SQL RETURNS NULL ON NULL INPUT PARAMETER STYLE TD_GENERAL EXTERNAL; Assumes this source in in current directory. Change to not protected mode to run at least 4 to 10 times faster: ALTER FUNCTION char2int EXECUTE NOT PROTECTED; needs GRANT ALTER FUNCTION privilege to execute ALTER statement *//* real simple */void char2int(VARCHAR_LATIN *chr, BYTEINT *result, char sqlstate[6]){ *result = *chr;}---------------------------------------------------- BTEQ -- Enter your DBC/SQL request or BTEQ command: select char2int('A'); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second.char2int('A')------------- 65 BTEQ -- Enter your DBC/SQL request or BTEQ command: select char2int('J'); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second.char2int('J')------------- 74 BTEQ -- Enter your DBC/SQL request or BTEQ command: select char2int(NULL); *** Query completed. One row found. One column returned. *** Total elapsed time was 1 second.char2int(Null)-------------- ?
I need ASCII value of characters, e.g. A=65 , B=66.I have tried Select CHR2HEXINT('A') which returns me the HEX value (0041) of the char passed as parameter.Anyone has any idea how to convert HEX (0041) to ASCII(65) using FORMAT or some other built-in function.Thanks