Sybase Data Type Conversion Functions

Sybase Data Type Conversion Functions change an expression from one datatype to another data type and reformat date and time information. SAP Adaptive Server provides three datatype conversion functions, convert, inttohex, and hextoint.

convert: converts between one datatype to another and specifies the display format.

Syntax:

convert(datatype, expression [, style])

Examples:

select title, convert(char(5), total_sales)
from titles
where type =”psychology”

hextoint: Used to convert hexadecimal data.hextoint accepts literals or variables consisting of digits and the uppercase and
lowercase letters A–F, with or without a “0x” prefix. The following are all valid uses of hextoint:
select hextoint(“0x000001000FFFF”)
select hextoint(“0x00000101”)
select hextoint(“100”)

Powered by k2schools