Data type conversion functions convert arguments from one data type to another.
Table 5-8 lists the data type conversion functions and their parameters.
Data type conversion function |
Parameters |
---|---|
CAST |
( expression AS datatype ) |
CONVERT |
( datatype, expression [ , format-style ] ) |
HEXTOINT |
( hexadecimal-string ) |
INTTOHEX |
( integer-expr ) |
ISDATE |
( string ) |
ISNUMERIC |
( string ) |
The DATE, DATETIME, DATEFORMAT, and YMD functions which convert expressions to dates, timestamps, or strings based on a date format are listed in the section “Date and time functions”. The STRING function, which converts expressions to a string, is discussed in the section “String functions”.
The database server carries out many type conversions automatically. For example, if a string is supplied where a numerical expression is required, the string is automatically converted to a number. For more information on automatic data type conversions carried out by Sybase IQ, see the section Data type conversions.