# Change a column's type

Shape / columns

change data type, detect type, set metadata or role

Page: <https://meridian.online/operations/change-a-columns-type>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

cast with failures becoming null

```sql
CREATE TEMP TABLE result AS
SELECT x, TRY_CAST(x AS INTEGER) AS as_int, TRY_CAST(x AS DATE) AS as_date
FROM (VALUES ('42'), ('2026-03-01'), ('n/a')) t(x);
SELECT * FROM result;
SELECT CASE WHEN ((SELECT count(as_int) = 1 AND count(as_date) = 1 AND max(as_int) = 42 AND count(*) FILTER (WHERE x = 'n/a' AND as_int IS NULL AND as_date IS NULL) = 1 FROM result)) THEN 'as expected' ELSE error('a value that does not parse did not become null') END AS verdict;
```

The statement builds its own data.

It needs nothing installed beyond DuckDB itself.

## Variants

- Convert a column to a named type: Change the stored data type of a column, failing or giving null on values that do not convert.
- Define a type or schema: Declare a named type, a type mapping or a schema that later steps use.
- [Detect column types from the data](https://meridian.online/operations/change-a-columns-type/detect-column-types): Scan the values of each column and set it to the type its data fits.
- Set column metadata: Attach or edit a column's domain, value set, display format or plot styling without changing its values.
- [Set a column's role](https://meridian.online/operations/change-a-columns-type/set-a-columns-role): Mark a column as a key, label, measure, dimension or semantic feature type without changing its values.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

- Azure Data Factory: [`Cast`](https://learn.microsoft.com/en-us/azure/data-factory/data-flow-cast) (read 2026-09-27)
- Azure Data Factory: [`Conversion functions`](https://learn.microsoft.com/en-us/azure/data-factory/control-flow-expression-language-functions) (read 2026-09-27)
- Azure Data Factory: [`Conversion functions`](https://learn.microsoft.com/en-us/azure/data-factory/data-flow-conversion-functions) (read 2026-09-27)
- Alteryx Designer: [`Auto Field`](https://help.alteryx.com/current/en/designer/tools/preparation/auto-field-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Feature Types`](https://help.alteryx.com/current/en/designer/tools/alteryx-intelligence-suite/machine-learning/feature-types.html) (read 2026-09-27)
- Apache DataFusion: [`Other Functions`](https://datafusion.apache.org/user-guide/sql/scalar_functions.html) (read 2026-09-27)
- Apache DataFusion: [`Type coercion`](https://datafusion.apache.org/user-guide/features.html) (read 2026-09-27)
- Apache DataFusion: [`cast /try_cast`](https://datafusion.apache.org/user-guide/features.html) (read 2026-09-27)
- dbt-utils: [`Cast functions`](https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros) (read 2026-09-27)
- dbt-utils: [`Data type functions`](https://docs.getdbt.com/reference/dbt-jinja-functions/cross-database-macros) (read 2026-09-27)
- DuckDB: [`CREATE TYPE`](https://duckdb.org/docs/current/sql/statements/create_type) (read 2026-09-27)
- DuckDB: [`Enum Functions (family)`](https://duckdb.org/docs/current/sql/functions/enum) (read 2026-09-27)
- Duckle: [`Cast / Convert Type`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- EasyMorph: [`Convert data type`](https://help.easymorph.com/doku.php?id=transformations:convert) (read 2026-09-27)
- AWS Glue: [`IntToIp`](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-pyspark-transforms-IntToIp.html) (read 2026-09-27)
- AWS Glue: [`IpToInt`](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-pyspark-transforms-IpToInt.html) (read 2026-09-27)
- AWS Glue: [`ResolveChoice`](https://docs.aws.amazon.com/glue/latest/dg/aws-glue-api-crawler-pyspark-transforms-ResolveChoice.html) (read 2026-09-27)
- Ibis: [`Cast`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/generic.py) (read 2026-09-27)
- Ibis: [`TryCast`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/generic.py) (read 2026-09-27)
- KNIME Analytics Platform: [`Color Designer (Apply)`](https://api.hub.knime.com/nodes/*yFgFhjiowvKidKRw?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Color Gradient Designer`](https://api.hub.knime.com/nodes/*KqzBthDheMvaWH5w?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Color Palette Designer`](https://api.hub.knime.com/nodes/*VA1Xk4iK1P7Vew_l?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Column Auto Type Cast`](https://api.hub.knime.com/nodes/*iQCmMxBEl2szprD5?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`DB Type Mapper`](https://api.hub.knime.com/nodes/*dX5ZVrdV7Jw2Sp0u?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Domain Calculator`](https://api.hub.knime.com/nodes/*Nutzr5xyUnXnn77w?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Double to Integer`](https://api.hub.knime.com/nodes/*2FShafCPSjRjnLWz?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Edit Nominal Domain`](https://api.hub.knime.com/nodes/*YMFDAdt-_6FGqYUe?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Edit Nominal Domain (Dictionary)`](https://api.hub.knime.com/nodes/*_-SMu_5_GxdJfPsq?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Edit Numeric Domain`](https://api.hub.knime.com/nodes/*qWMVNYtwvvHxDv_z?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Image to Table`](https://api.hub.knime.com/nodes/*UJSesR7RLSlocCzM?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Number Format Manager`](https://api.hub.knime.com/nodes/*UWKMKdjmp84_TtdB?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Number to String`](https://api.hub.knime.com/nodes/*s--Phzu0nUXeg0E9?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Number to String (PMML)`](https://api.hub.knime.com/nodes/*DmqV_TCRzTqeu66F?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Path to String`](https://api.hub.knime.com/nodes/*ZLCisQlHCzW4IiZG?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Path to URI`](https://api.hub.knime.com/nodes/*YMvcvDu5EC56OIFg?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Shape Appender`](https://api.hub.knime.com/nodes/*h7WuYKCLKThHkRgh?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Shape Manager`](https://api.hub.knime.com/nodes/*usCSX6xiQpdwbil_?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Size Appender`](https://api.hub.knime.com/nodes/*EHJ4ymglh4dRzXQ8?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Size Manager`](https://api.hub.knime.com/nodes/*3pchf2ky6T9ZEGqN?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String Format Manager`](https://api.hub.knime.com/nodes/*cr_B5IrwLlGv6A63?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String to Number`](https://api.hub.knime.com/nodes/*gXR6yic77CM35Zfx?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String to Number (PMML)`](https://api.hub.knime.com/nodes/*F-MLIYuk6D9mC5vv?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String to Path`](https://api.hub.knime.com/nodes/*tMm7vSgdcpf0fYMi?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`String to SVG`](https://api.hub.knime.com/nodes/*rIH6-Uyow8_4HF8O?details=full) (read 2026-09-27)
- KNIME Analytics Platform: [`Table to Image`](https://api.hub.knime.com/nodes/*DrXVUHMX1uH3lVqD?details=full) (read 2026-09-27)
- Apache NiFi: [`Type Coercion`](https://nifi.apache.org/nifi-docs/expression-language-guide.html) (read 2026-09-27)
- OpenRefine: [`To date`](https://openrefine.org/docs/manual/cellediting#data-type-transforms) (read 2026-09-27)
- OpenRefine: [`To number`](https://openrefine.org/docs/manual/cellediting#data-type-transforms) (read 2026-09-27)
- OpenRefine: [`To text`](https://openrefine.org/docs/manual/cellediting#data-type-transforms) (read 2026-09-27)
- Pentaho Data Integration: [`Annotate stream`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Pentaho Data Integration: [`Shared dimension`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- Polars: [`DataFrame.cast`](https://docs.pola.rs/api/python/stable/reference/dataframe/modify_select.html) (read 2026-09-27)
- Polars: [`Expr manipulation/selection: type conversion (group)`](https://docs.pola.rs/api/python/stable/reference/expressions/modify_select.html) (read 2026-09-27)
- Polars: [`Expr.ext (group)`](https://docs.pola.rs/api/python/stable/reference/expressions/extension.html) (read 2026-09-27)
- Polars: [`Expr.str: parse numbers (group)`](https://docs.pola.rs/api/python/stable/reference/expressions/string.html) (read 2026-09-27)
- Polars: [`SQL functions: Types (group)`](https://docs.pola.rs/api/python/stable/reference/sql/functions/types.html) (read 2026-09-27)
- Power Query M: [`Logical functions`](https://learn.microsoft.com/en-us/powerquery-m/logical-functions) (read 2026-09-27)
- Power Query M: [`Table.AddKey`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Table.ReplaceKeys`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Table.ReplacePartitionKey`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Table.TransformColumnTypes`](https://learn.microsoft.com/en-us/powerquery-m/table-functions#transformation) (read 2026-09-27)
- Power Query M: [`Type functions`](https://learn.microsoft.com/en-us/powerquery-m/type-functions) (read 2026-09-27)
- RapidMiner Studio: [`Add`](https://docs.rapidminer.com/latest/studio/operators/blending/values/add.html) (read 2026-09-27)
- RapidMiner Studio: [`Convert Type (In Database)`](https://docs.rapidminer.com/latest/studio/operators/extensions/In-Database%20Processing/indb_blending/indb_type.html) (read 2026-09-27)
- RapidMiner Studio: [`Format Numbers`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/format_numbers.html) (read 2026-09-27)
- RapidMiner Studio: [`Guess Types`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/guess_types.html) (read 2026-09-27)
- RapidMiner Studio: [`Nominal to Text`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/nominal_to_text.html) (read 2026-09-27)
- RapidMiner Studio: [`Numerical to Polynominal`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/numerical_to_polynominal.html) (read 2026-09-27)
- RapidMiner Studio: [`Numerical to Real`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/numerical_to_real.html) (read 2026-09-27)
- RapidMiner Studio: [`Parse Numbers`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/parse_numbers.html) (read 2026-09-27)
- RapidMiner Studio: [`Real to Integer`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/real_to_integer.html) (read 2026-09-27)
- RapidMiner Studio: [`Remap Binominals`](https://docs.rapidminer.com/latest/studio/operators/blending/values/remap_binominals.html) (read 2026-09-27)
- RapidMiner Studio: [`Remove Unused Values`](https://docs.rapidminer.com/latest/studio/operators/cleansing/missing/remove_unused_values.html) (read 2026-09-27)
- RapidMiner Studio: [`Set Meta Data`](https://docs.rapidminer.com/latest/studio/operators/extensions/Operator%20Toolbox/utility/set_metadata.html) (read 2026-09-27)
- RapidMiner Studio: [`Set Positive Value`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/set_positive_value.html) (read 2026-09-27)
- RapidMiner Studio: [`Set Role`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/names_and_roles/set_role.html) (read 2026-09-27)
- RapidMiner Studio: [`Text to Nominal`](https://docs.rapidminer.com/latest/studio/operators/blending/attributes/types/text_to_nominal.html) (read 2026-09-27)
- Apache SeaTunnel: [`Define Sink Type`](https://seatunnel.apache.org/docs/2.3.13/transforms/define-sink-type) (read 2026-09-27)
- Tableau Prep: [`Change Data Type`](https://help.tableau.com/current/prep/en-us/prep_explore.htm) (read 2026-09-27)
- Tableau Prep: [`Type conversion functions (group)`](https://help.tableau.com/current/prep/en-us/prep_function_reference.htm) (read 2026-09-27)
- Talend: [`tConvertType`](https://help.qlik.com/talend/en-US/components/8.0/processing/processing-component) (read 2026-09-27)
- Talend: [`tSetDynamicSchema`](https://help.qlik.com/talend/en-US/components/8.0/dynamic-schema/dynamic-schema-component) (read 2026-09-27)
- Trifacta: [`Change column type`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- Trifacta: [`Lock type`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- Trifacta: [`Settype Transform`](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/language-appendices/transforms.html) (read 2026-09-27)
- Trifacta: [`Type Functions (group)`](https://help.alteryx.com/aac/en/trifacta-classic/wrangle-language/type-functions.html) (read 2026-09-27)
- Trifacta: [`Unlock type`](https://help.alteryx.com/aac/en/trifacta-classic/reference/transformation-reference.html) (read 2026-09-27)
- VisiData: [`addcol-cast`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/apps/vdsql/_ibis.py#L766) (read 2026-09-23)
- VisiData: [`key-col`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1292) (read 2026-09-23)
- VisiData: [`key-col-off`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1294) (read 2026-09-23)
- VisiData: [`key-col-on`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1293) (read 2026-09-23)
- VisiData: [`key-off-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L139) (read 2026-09-23)
- VisiData: [`key-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L138) (read 2026-09-23)
- VisiData: [`type-any`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1304) (read 2026-09-23)
- VisiData: [`type-any-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L150) (read 2026-09-23)
- VisiData: [`type-currency`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/type_currency.py#L30) (read 2026-09-23)
- VisiData: [`type-currency-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L148) (read 2026-09-23)
- VisiData: [`type-date`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/type_date.py#L130) (read 2026-09-23)
- VisiData: [`type-date-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L147) (read 2026-09-23)
- VisiData: [`type-datedelta`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/type_date.py#L131) (read 2026-09-23)
- VisiData: [`type-datetime`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/type_date.py#L132) (read 2026-09-23)
- VisiData: [`type-float`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1308) (read 2026-09-23)
- VisiData: [`type-float-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L144) (read 2026-09-23)
- VisiData: [`type-floatlocale`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1309) (read 2026-09-23)
- VisiData: [`type-floatlocale-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L152) (read 2026-09-23)
- VisiData: [`type-floatsi`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/type_floatsi.py#L35) (read 2026-09-23)
- VisiData: [`type-floatsi-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L151) (read 2026-09-23)
- VisiData: [`type-int`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1306) (read 2026-09-23)
- VisiData: [`type-int-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L145) (read 2026-09-23)
- VisiData: [`type-ipaddr`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/features/type_ipaddr.py#L54) (read 2026-09-23)
- VisiData: [`type-ipnet`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/features/type_ipaddr.py#L60) (read 2026-09-23)
- VisiData: [`type-len`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1307) (read 2026-09-23)
- VisiData: [`type-len-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L146) (read 2026-09-23)
- VisiData: [`type-soupstr`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/loaders/scrape.py#L173) (read 2026-09-23)
- VisiData: [`type-string`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/sheets.py#L1305) (read 2026-09-23)
- VisiData: [`type-string-selected`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/visidata/metasheets.py#L149) (read 2026-09-23)
- Yggdrasil Decision Forests: [`Feature / Column`](https://github.com/google/yggdrasil-decision-forests/blob/0a54b57c95ff0cf42ecf0310ace0513a4f32cb65/yggdrasil_decision_forests/port/python/ydf/dataset/dataspec.py) (read 2026-09-27)
- Yggdrasil Decision Forests: [`Semantic`](https://github.com/google/yggdrasil-decision-forests/blob/0a54b57c95ff0cf42ecf0310ace0513a4f32cb65/yggdrasil_decision_forests/port/python/ydf/dataset/dataspec.py) (read 2026-09-27)
