Expand my Community achievements bar.

SOLVED

changing a datatype

Avatar

Level 3

In adobe campaign classic v7, in a schema, if I change the datatype of an attribute like integer to string, what is going to happen to the existing data?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @rbiri ,

When you change the datatype of an attribute, you have to update the database structure. While doing this, you can notice in SQL statement that the existing old data type column will get dropped and a new field will get created in the table with new datatype, with the same internal name.

ALTER TABLE SchemaName
     ADD COLUMN sMyColumn VARCHAR(255);
ANALYZE SchemaName;
ALTER TABLE SchemaName
     DROP COLUMN iMyColumn;

So while dropping the old data type column, all the data will also get deleted along with the field. And a new field will get created with the new data type and data will be empty for this field.

To save the data, you can export the data to a CSV file and after changing the data type and updating the database structure, import the file using import workflow and update the records into the schema.

View solution in original post

3 Replies

Avatar

Community Advisor

Hello @rbiri  If you are changing int to string then it should be ok. I have not done it myself but i would suggest testing it on a lower env first.

 

If you see anything is breaking then create a new attribute as string and move data from old attribute to new attribute by in the correct datatype. 


     Manoj
     Find me on LinkedIn

Avatar

Correct answer by
Community Advisor

Hi @rbiri ,

When you change the datatype of an attribute, you have to update the database structure. While doing this, you can notice in SQL statement that the existing old data type column will get dropped and a new field will get created in the table with new datatype, with the same internal name.

ALTER TABLE SchemaName
     ADD COLUMN sMyColumn VARCHAR(255);
ANALYZE SchemaName;
ALTER TABLE SchemaName
     DROP COLUMN iMyColumn;

So while dropping the old data type column, all the data will also get deleted along with the field. And a new field will get created with the new data type and data will be empty for this field.

To save the data, you can export the data to a CSV file and after changing the data type and updating the database structure, import the file using import workflow and update the records into the schema.

Avatar

Administrator

Were you able to resolve this query with the help of the given solutions or do you still need more help here? Do let us know. In case the given solutions were helpful, then kindly choose the one that helped you the most as the 'Correct Reply'.
Thanks!



Sukrity Wadhwa