0

I am new to SFMC and SQL and I am learning as I go. My google tech support has failed me on this one. So if this is an obvious, please excuse my ignorance.

I am creating a DE that will contain multiple groups of people based on a series of criteria. Each criteria will need it's own segment label, as the email content will be dynamic based on the segment. My initial though was a series of SQL activities in an automation, with each SQL activity inserting the correct segment value in the "Segment" field along with email and subscriber key. However, I cannot figure out how to insert a default value for a field in the SQL activity. This is the SQL I have right now:

SELECT c.Email, c.SubscriberKey, segment From ent.tableC c INNER JOIN ent.tableM m ON c.identifier = m.identifier WHERE m.CriteriaFeild = 'criteria' 

I can't use the default value at the DE field level, as it will be different for each group. How can I modify the SQL to insert 'CriteriaLabel' into the segment field for each record pulled?

Thanks for your help.

1 Answer 1

0

If I am understanding your question correctly, it is actually much easier than you are thinking.

To have a 'default' value in SQL, you just do:

SELECT c.Email, c.SubscriberKey, 'CriteriaLabel' as segment

and this will always make 'segment' column equal the string "CriteriaLabel".

2
  • I tried this and the automation failed with the "Automation failed due to system error" message. The syntax validates within the SQL activity, so maybe something is wrong with my target DE. Commented May 3, 2018 at 14:38
  • 1
    I think I got it. I added a Where c.Email IS NOT NULL condition, as email was my primary key in the target DE and it ran with the correct label inserted. Thanks! Commented May 3, 2018 at 14:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.