Skip to main content
Level 2
February 10, 2020
Resuelto

How do i select values from enrichment to insert them into table using SQL code activity

  • February 10, 2020
  • 2 respuestas
  • 2758 visualizaciones

Hi ,

 

I am using SQL code activity to do insert into custom table . From the the below code i want the data from enrichment before sql code activity. Can some one give me sample query to fetch values from enrichment and insert into table. 

 

INSERT INTO Customtable(column1, column2, column3, ...)
SELECT column1(From enrichment), column2, column3(From enrichment), ...
FROM enrichment.

 

 

 

Este tema ha sido cerrado para respuestas.
Mejor respuesta de Craig_Thonis

Hi,

 

If you are trying to view the data being inserted then you can either perform a preview, or you can execute the workflow to the point where the enrichment runs, then simply right click on the output transition from the enrichment.  This will allow you to view the data and export it if desired.

 

When it comes to inserting the data, I would not recommend using the SQL Code activity but instead using the update data activity.  The SQL activity doesn't actually execute SQL within the activity itself but calls upon templates (see documentation below):

https://docs.adobe.com/content/help/en/campaign-classic/using/automating-with-workflows/action-activities/sql-code-and-javascript-code.html

 

Regards,

 

Craig

2 respuestas

Craig_Thonis
Adobe Employee
Craig_ThonisAdobe EmployeeRespuesta
Adobe Employee
February 11, 2020

Hi,

 

If you are trying to view the data being inserted then you can either perform a preview, or you can execute the workflow to the point where the enrichment runs, then simply right click on the output transition from the enrichment.  This will allow you to view the data and export it if desired.

 

When it comes to inserting the data, I would not recommend using the SQL Code activity but instead using the update data activity.  The SQL activity doesn't actually execute SQL within the activity itself but calls upon templates (see documentation below):

https://docs.adobe.com/content/help/en/campaign-classic/using/automating-with-workflows/action-activities/sql-code-and-javascript-code.html

 

Regards,

 

Craig

Level 2
February 11, 2020

I want to invert the table which i am getting from enrichment. So is there any other way to do this with our SQL code activity?

 

ID  FirstName LastName Email

1   Name1       Name12    Email1

2   Name2       Name22    Email2

3   Name3       Name32    Email3

 

i want to convert above table into

 

ID   AttributeName   AttributeValue

1     FirstName        Name1

1     LastName        Name12

1     Email                Email1

2     FirstName        Name2

2     LastName        Name22

2     Email                Email2