Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Copy of attribute data (or) Loss of data in a schema

Avatar

Avatar
Give Back 25
MVP
Venu_Reddy
MVP

Likes

163 likes

Total Posts

171 posts

Correct Reply

53 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Give Back 25
MVP
Venu_Reddy
MVP

Likes

163 likes

Total Posts

171 posts

Correct Reply

53 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
Venu_Reddy
MVP

18-01-2019

Hi All,

Can we copy the column data in a schema into another?

I'm trying to change the data type of an attribute in a schema and worried that i lost the previous data which are already present in the attribute when i change the datatype.

For eg: Column/Attribute  A of type INTEGER has some data. Now i'm trying to change the data type to VARCHAR/STRING where i will loose the previous data.

Is there any possibility to avoid the loss of data?

Your response will be appreciate

Regards,

Venu

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
MVP
Jean-Serge_Biro
MVP

Likes

353 likes

Total Posts

464 posts

Correct Reply

153 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Jean-Serge_Biro
MVP

18-01-2019

Hi Venur,

This question is more related to the underlying database engine (RDBMS) than Adobe Campaign itself.So take care and check carefull,

For most database engines (SQL Server, Oracle etc), alter table modify column instruction would loose data if the datatype is not in the same family, and a supersed.

For instance, short int to long int, ok but long int to short you could loose values by the casting. The same from varchar(100) to varchar(200), no problem.

And from very different types such as int, date, string, you would loose all data.

So take care and check carefully depending on source/destination types, if a simple alter is possible or not.

So if not the case, the directive is:

1. create a new column.
2. copy (insert casting-converting instruction(col2) select  col1 SQL query) the current values of col1 casted/converted (using Convert, decode, and all the sql functions depending on your engine) into col2 column
3. suppress the col1 column.

Regards

J-Serge

Answers (3)

Answers (3)

Avatar

Avatar
Give Back 25
MVP
Venu_Reddy
MVP

Likes

163 likes

Total Posts

171 posts

Correct Reply

53 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Give Back 25
MVP
Venu_Reddy
MVP

Likes

163 likes

Total Posts

171 posts

Correct Reply

53 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
Venu_Reddy
MVP

21-01-2019

Hi Jean,

Thank you for your help.

Finally achieved the expectation and resolved

Avatar

Avatar
Give Back 25
MVP
Venu_Reddy
MVP

Likes

163 likes

Total Posts

171 posts

Correct Reply

53 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Give Back 25
MVP
Venu_Reddy
MVP

Likes

163 likes

Total Posts

171 posts

Correct Reply

53 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
Venu_Reddy
MVP

21-01-2019

Hi J-Serge,

Thank you for quick reply.

I created a new column and tried to copy the data from one column to another using decode (Source expression) but getting failed where i have to query it.

Can you please elaborate the step-2 with an example as it will be really helpful.

So if not the case, the directive is:

1. create a new column.


2. copy (insert casting-converting instruction(col2) select  col1 SQL query) the current values of col1 casted/converted (using Convert, decode, and all the sql functions depending on your engine) into col2 column


3. suppress the col1 column.

Regards,

Venu

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

957 likes

Total Posts

1,079 posts

Correct Reply

506 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

957 likes

Total Posts

1,079 posts

Correct Reply

506 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

18-01-2019

Hi,

I do this all the time when fixing bad implementations. Just alter the columns as desired, then write your own SQL to effect the changes. Syntax varies based on the RDBMS you're using, for SQL Server 'alter table x alter column y varchar(30)' etc. This can be a slight challenge due to the autogenerated constraints Campaign adds to numeric types, though these are discoverable via workflow audit logs and can be dropped/recreated as part of the migration. Do not use the update data structure wizard here- it has no mechanism to detect in-place changes and will instead see the missing and new as drop and create.

Thanks,

-Jon