13
Views
5
Comments
Migrate data from one attribute to other attribute.
Application Type
Traditional Web

Hello team

 As of now I have an entity "Entity1" in use which has a particular  attribute say "Attr1". Now I have  to use another entity "Entity2" containing same attribute "Attr1" which will be referred in Entity1 later. Attr1 from Enity1 will be removed. 

Now my doubt is I have to move the data from Entity1's Attr1 to Entity2's Attr1. How can I do it?

My approach is: For each of the EntityList, assign Entity1's Attr1 to Entity2's Attr1 then update Entity2.  Will this work?

Regards,

Ankita

Rank: #56

Hi Ankita,


Usually, the best, more performant way to do this is to run a timer that does an advanced SQL which does something like this:


UPDATE {Entity2}

SET {Entity2}.[Attr1] = {Entity1}.[Attr1]

FROM {Entity2}

INNER JOIN

{Entity1}

ON <Define your join condition>


Since you probably want to do the same data migration, you can also run this timer in the other environments of your pipeline to have the data migrated in each environment.


Regards,
João

Rank: #1154

Hi Joao, 

Thank you for the response.

Can you suggest on what bases the join condition should be?

Rank: #56

Hi Ankita,


It depends on your data model. How do you know from which record of Entity1 you want to update the corresponding record in Entity2?

If for instance, they match with the same Id attribute, then your JOIN condition should be ON {Entity1}.[Id] = {Entity2}.[Id]


Regards,
João

Rank: #297

Hi Ankita,

In addition to João's reply, If Entity2 don't have all the data that Entity1 had,
You also have to use insert select to add some date to entity2

Kind Regards


Rank: #311

Hi Ankita,

As mentioned by João, you can use Advance SQL to update the attributes. However, in order to get more knowledge/idea please refer this link. Hope you will get answer of all your queries related to update the value from one entity to another. :)

Thanks & Kind Regards,

Sachin