# convert

## Overview

The `convert` statement is used to convert values in a column from base-10 to base-16 or vice-versa.

## Syntax

**`convert`***`colName`***`to decimal|hex from decimal|hex`**

{% hint style="info" %}
The keywords `dec`and`decimal`and the keywords`hex`and`hexadecimal`are equivalent.
{% endhint %}

## 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 `0`
* Blank values are ignored
* The `convert` statement  may be used in the body of a `where` statement
* If a value in *colName* contains a partially correct value such as `123xyz` then it will be treated as a number up to the first invalid character, in this case resulting in a value of `123`.
* 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 `convert` statement 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 dec
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olddocs.exivity.io/3.4.3/data-pipelines/transform/language/convert.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
