SQL Query in SFMC

 

 SQL Query in SFMC


To run SQL in Automation Studio in SFMC (Salesforce Marketing Cloud), we use an SQL Query
 Activity inside an automation. 

Source DE:-




SFMC > Journey Builder > Automation Studio

SQL Query Activity:

Select [Email Address],[First Name],[Last Name],[Gender],[Subscription Status] FROM [ab testing DE Naveen]


After Automation:-




Target DE:-






How to Set Up SQL Query Activity in SFMC?

Step 1: Create a New SQL Query Activity


1️⃣ Go to Automation Studio → Click "Activities"
2️⃣ Click "Create Activity" → Select "SQL Query"
3️⃣ Enter an Activity Name and Description

Step 2: Write Your SQL Query

  • SQL in SFMC is based on T-SQL (Transact-SQL), but it has some limitations (e.g., no INSERT, UPDATE, or DELETE commands).

  • The SELECT query pulls data from one or more Data Extensions and inserts it into a new Target Data Extension.

Step 3: Select a Target Data Extension

  • SQL queries do not modify the original data.

  • The result is saved in a new or existing Data Extension.

  • Choose an existing Data Extension or Create a New One with the required fields.

💡 Target Data Extension should match the fields in your SELECT statement.

Step 4: Run the SQL Query

1️⃣ Click "Save & Run"
2️⃣ Check the Activity Log to see if the query was successful
3️⃣ Verify the Target Data Extension to ensure data is correctly inserted

Comment















Comments

Popular posts from this blog

Data filter