convert
Overview
The convert statement is used to convert values in a column from base-10 to base-16 or vice-versa.
Syntax
convertcolNameto decimal|hex from decimal|hex
Details
When converting values in a column, the following considerations apply:
Values in the column are replaced with the converted values
The colName argument must reference an existing column, and may optionally be fully qualified (else the column is assumed to be in the default DSET)
If any values in the column are not valid numbers, they will be treated as
0Blank values are ignored
The
convertstatement may be used in the body of awherestatementIf a value in colName contains a partially correct value such as
123xyzthen it will be treated as a number up to the first invalid character, in this case resulting in a value of123.The hex digits in the original value can be either upper or lower case
The hex digits from A-F will be rendered in upper case in the converted output
The
convertstatement only supports integer values (floating points will be treated as floored to the nearest integer)
Example
convert decimal_count from decimal to hex
convert unique_id from hexadecimal to decLast updated
Was this helpful?