Changing a data type
Changing a data type
Background
How can I change an attribute from one data type to another?
In the simplest cases like increasing the length of a String column, xDM will alter the physical columns for you automatically when re-deploying the data location.
Here's a more interesting case. We deploy a model with the attribute GeocodedAddress.Quality with type String(128). Later we realize that a more appropriate data type would be Integer.
Standard solution
- Drop your tables.
- Redeploy.
This is a solid solution. It will always work.
But at development time it can be a hassle to lose all data and then re-load.
Alternate solution
- Directly alter your tables.
- Redeploy.
This is a nice time saver at development time. It's not recommended for a production data location.
Sample SQL to alter tables (PostgreSQL syntax shown):
Manually change data types
alter table SA_ADDRESS_CACHE alter column GEOQUALITY type decimal(10,0) using GEOQUALITY::decimal(10,0) ; alter table GX_ADDRESS_CACHE alter column GEOQUALITY type decimal(10,0) using GEOQUALITY::decimal(10,0) ; alter table GD_ADDRESS_CACHE alter column GEOQUALITY type decimal(10,0) using GEOQUALITY::decimal(10,0) ; /* Of course this will fail if your data contains non-numeric values. That shouldn't surprise anyone. */
, multiple selections available,
Related content
Resetting a Data Location
Resetting a Data Location
More like this
Upgrading Models with Reserved Physical Column Names to Version 3.2 and Above
Upgrading Models with Reserved Physical Column Names to Version 3.2 and Above
More like this
Migrating Your Backend Database from Oracle to PostgreSQL
Migrating Your Backend Database from Oracle to PostgreSQL
More like this
Refresh an MDM Development environment with Production Data
Refresh an MDM Development environment with Production Data
More like this