In this article, we will try to understand how to copy data from one Data extension to other Data Extension. Sometimes there will be scenarios where you want to change a field type or set a primary key on existing data extension with data. The only option in those scenarios is to drop the existing data and then update the field or set the primary key.
For this demo, I am using Customer_Form Data extension which has only 6 records. We want to change the primary key from Name to Email Address and since the data has been populated we cannot change that until we drop the data. When the volume is less it is easier to do export the data and reimport the file which is less than 20 mb.
Click on Clone on right-hand side top corner next to delete button in order to clone the data extension. This will automatically clone the fields with similar data types and populate the new data extension with Customer_Form_copy(Data extension name_copy).
Click on Save to see the Data extension populated with Similar fields from original data extension without any data. I also added Primary key to Email address after cloning the data extension.
In order to populate data from one data extension to other data extension, we can use SQL query in the Automation studio and schedule the job to run immediately or hourly or daily.
Drag the SQL Query from the palette on the left side and configure the properties by providing desired details such as Name/External Key/Folder Location/ Description.
Click on Next at the bottom and select desired data extension and populate/select desired fields in the query.
Select the desired Target data extension(Customer_Form_Copy) and desired Data action(Append/Update/Override).
Click Finish and you will be redirected to the initial Automation page. Once you click on save it will give you the ability to run once or click on configure to run on desired schedule
Click on Run once and you will be redirected to below screen. MC Team wants to make sure you haven’t accidentally click on run button so they would ask you to click on run button one more time in below screen.
After click on run we can see the results on the overview page of Automation studio as shown below.
Lets validate if our customer_Form_copy data extension is populated with desired records by navigating to Data extensions from Contact builder or Email studio.
We have successfully populated Customer_Form_Copy data extension with data by using SQL Query in Automation studio from Customer_Form data extension. Now we could delete the Customer_Form data extension and rename the existing Customer_Form_Copy data extension to Customer_Form data extension.