Data Extensions

What a data extension is in Marketing Cloud Engagement: types, fields, primary key, data retention, sends and relationships in Data Designer.

A marketing team needs to hold its customers’ data in Marketing Cloud Engagement and send them messages. Where does that data live, and which decisions about that table can no longer be undone afterwards?

What a data extension is

A data extension is, in Help’s words, a table that contains data that you provide: customer data, loyalty points, tracking and usage data.

Each one has a name, which identifies it within the system; an external key, which identifies it in API (application programming interface) calls and in the platform’s two own languages, AMPscript and Server-Side JavaScript (SSJS), and which Contact Builder generates if none is given; a description; and a collection of fields — the columns — each with a name, a data type and a length. A row of data is a record.

A word on vocabulary: Help calls “attribute” both the column of a table and the piece of data hanging off the contact record. This page writes field for the column and attribute for the second, the business of the sibling page of this node on Contact Builder. Only two of this page’s sources print an editions block, and both agree: Basic, Pro, Corporate and Enterprise.

The three types, and who decides them

The properties tab names three types of data extension — standard, filtered and random — and says of that field that the application sets it. The creation articles say something else: there it is the user who picks one of the three. No source explains the contradiction, so this page leaves it in plain sight and does not decide who decides.

Type What it is What to know
Standard The table you create with its own fields It is the one you pick when creating from new
Filtered Generated by filtering fields, filters and measures over a source table It takes on the source’s characteristics; to make it sendable or non-sendable you change the source
Random Splits into new tables the subscribers — the people who have opted in to receive communications on a channel — of a source standard table You can create as many as 12 tables at a time; an Add Remainder button creates a table from the remaining subscribers

The filtered trap: new or modified records do not arrive on their own, you have to refresh it. To remove data from it you remove it from the source and refresh.

The storage report is updated daily, and Help asks you to use it to find your largest tables and shorten their period if you can. There “type” is something else: Custom, a user created it, and System, the system generated it and it does not count toward the account’s maximum storage.

The fields, and what cannot be undone

Defining a field means choosing a name, a data type and a length; the name accepts only alphanumeric characters, spaces, dashes, underscores and periods.

Data type What it accepts, quoted from Help
Text Letters, numbers and spaces, up to 4,000 characters
Number An integer between -2,147,483,648 and 2,147,483,648
Date A date between 01/01/1753 and 12/31/9999 23:59:59.998, stored in mm/dd/yyyy format
Boolean True: 1, Y, Yes, true. False: 0, N, No, false
Email An email address; username up to 100 characters, full address up to 254
Phone 15-digit strings; on import or API insertion, nondigit characters are removed
Decimal Precision up to 38 digits and scale up to 17
Locale An ISO (International Organization for Standardization) language and country code; the two-character country code is required, and up to five are accepted

A maximum length can be specified only on Text and Decimal. And there are four things Help says can no longer be changed.

What no longer changes What Help says
Decreasing the length of a Text field You can increase it, not decrease it
Altering the length of a Decimal field You can’t alter it after you create the field
Modifying the primary key (Primary Key) fields They can’t be modified once the data extension is created
Relinking a table that was linked to the contact model and then unlinked The sentence is about tables that are already linked: they remain linked until you unlink them, and after that you can’t relink. And to delete a linked one you have to remove its relationships first, see the “Deleting” row below

About the primary key Help adds: unique value, 850 characters at most, no more than three columns and never a Date column.

And one checkbox whose meaning is not clear: Nullable. The creation article says “to require the field to contain a value, select Nullable”, the opposite of what the name suggests. The Contact Builder article describes a property it calls Required, the one indicating whether the attribute permits a blank value, and never names Nullable at any point: that the two are the same control is established by no source. Check it in the account. The name of the email data type is not settled either: Email, EmailAddress and Email Address all coexist in Help.

Who may touch it is set separately, with the data extension policies: three checkboxes only an administrator changes, to allow deleting the table, modifying its existing fields or adding new ones.

Sendable and testable

Two checkboxes decide whether the table can be the audience of a send: Is Sendable makes it eligible for message sends and Is Testable for test sends. The properties article describes a differently named pair, Used For Sending and Used For Testing, where the second only counts if the first is selected; that they are the same pair is this page’s reading, not a Help sentence.

If the table is sendable you also have to declare how it relates to subscriber data: in Send Relationship you pick a field that corresponds to a subscriber value and, beside it, whether it is the subscriber key or the subscriber ID, its internal identifier. Only the Text, Email Address or Phone types can be related to the subscriber key, and the email type is required in order to send email to the table.

What the contact, the contact key and the subscriber key are is explained by that same sibling page.

The retention policy: what exactly it deletes

The data retention policy determines how long a table’s data is kept: it deletes information older than a given date. Each account’s default period is 6 months, which can be modified, and Help refers you to your account executive regarding that feature.

When you switch Retention Setting on you have to choose what it deletes, and the three options do not leave the same thing behind.

Scope What it deletes when the period elapses
Individual Records Each record separately; with a 30-day period, each record is deleted 30 days after it arrives
All records and data extensions The data extension and all the data within it
All records Every record, leaving the table itself intact but empty

The period goes in days, weeks, months or years, or as a specific date; Reset period on import resets it on import, only if it was given in days.

Two things this page does not claim, because none of the sources it cites says so: whether the setting can be returned to Off, and whether what retention deletes can be recovered. The two windows those sources do publish cover deletions made by hand: a deleted table goes to the Recycle Bin and can be restored for up to 30 days, and records cleared with Clear Records are kept for another 30. Neither is about deletion by policy.

Why the All records and data extensions scope prevents linking the tableA data retention policy is the setting that decides how long the data of a data extension, that is of a table in Marketing Cloud Engagement, is kept. When you switch it on you have to choose its scope. With the All records and data extensions scope, Salesforce Help says that when the period elapses the data extension and all the data within it are deleted. The same Help says that a data extension with the All records and data extensions policy can't be linked to the Contact model, the structure the sibling Contact Builder page describes. From those two sentences this page infers, and marks it as its own reading, that this scope only serves a standalone table, not one that is part of the model. The alternative Help documents is the All records scope, which deletes every record and leaves the table itself intact but empty.Retention scopeAll records anddata extensionsDeletes the tableand all its dataCan't be linked tothe Contact modelScope All records:leaves it empty, not deleted

Relationships in Data Designer, or a standalone table

A data extension can live on its own or be part of the contact model. Data Designer, the Contact Builder tool that the sibling page explains, links tables to the contact record or to each other. The link goes from one attribute to another with a declared cardinality: the link dialog offers One-to-One, One-to-Many, Many-to-One and Many-to-Many; the Data Designer article lists a different set, with Population and without Many-to-One.

Link restriction What Help says
Data types The two attribute names may differ, the types have to match
Attribute name One longer than 256 characters cannot be linked
“All records and data extensions” policy That table cannot be linked to the Contact model
Deleting A table linked to the model cannot be deleted, neither from Contact Builder nor by API; its relationships have to be removed in Data Designer first
Names Contact is a reserved word, and Data Designer does not support non-English characters in the table name

Changing a cardinality that already exists has consequences the sibling page spells out; they are worth reading before touching a link.

That a table left unlinked stays outside the contact model is this page’s reading of two Help sentences, not a sentence of its own.

How the data gets in

This page names the routes; each one has its own documentation.

Route Where it lives
By hand, record by record Contact Builder: create, edit, remove and restore records
Import onto the table Contact Builder, to use the updated data across every channel
Large sets from an external file or from another table Automation Studio, Data Copy or Import activity
A query over other tables Automation Studio, SQL Query activity
Filtering, and extraction outwards Automation Studio, Filter and Data Extract activities
Programmatic API, AMPscript and SSJS, through the table’s external key

One rule of the SQL (structured query language) Query activity: the target table cannot be any of the ones the query uses; the write mode is Append, Update or Overwrite, and Overwrite deletes what was there before. The data views and SQL queries have their page in this node.

Example: a private bank’s quarterly campaign

A private bank wants to send a quarterly portfolio report to its clients, with data from the banking core that must not stay longer than necessary. The case is invented; the order of the steps is this page’s proposal, not a sequence Help recommends.

  1. A standard table, created from new with the report’s fields.
  2. Decide the primary key before creating it. The client identifier, a Text field, not a date. This is the step with no way back.
  3. Make it sendable and declare the relationship. Is Sendable, and in Send Relationship the client identifier against the subscriber key, which the sibling page establishes as the same value as the contact key. Help’s own example relates EmailAddress to SubscriberKey, exactly the pattern the contact model advises against.
  4. Choose the retention scope, not just the period. The table is going to be linked to the model, so “All records and data extensions” is ruled out; with “All records” and three months, the table still exists and its records are deleted.
  5. Link it in Data Designer with the types aligned: the client identifier against its equivalent in the model, both of the same data type.
  6. Don’t touch it with an active journey on top. An activated journey works from a snapshot of its entry source table and does not detect fields added afterwards.

To be plain about what step 4 does: when the period elapses, the records are deleted. The table survives, the data does not, and this page does not know whether that deletion can be reversed.

What to choose in each case

The criterion below is this page’s reasoning: no source publishes a decision table.

Situation What to choose
Your own data that has to be stored and sent to A standard table, sendable, with its Send Relationship declared
A subset of the same audience for one campaign A filtered one over that table, remembering that it has to be refreshed
Splitting an audience into cells for a test A random one: up to 12 tables, and Add Remainder for the remaining subscribers
High-volume temporary data that nothing links The “All records and data extensions” scope, which takes the whole table
Temporary data in a table that is in the model The “All records” scope: keeps the table and deletes the rows
Data that expires row by row The “Individual Records” scope, with the period counted from each row’s arrival
Stopping a user from deleting or altering the table The data extension policies, which only an administrator changes

Before production

  1. Check that the primary key is the final one, and the Text and Decimal lengths with room to spare (see “The fields, and what cannot be undone”).
  2. If the table is going to send, confirm Is Sendable and that Send Relationship points at a Text, Email Address or Phone field (see “Sendable and testable”).
  3. Choose the retention scope before the period, and rule out “All records and data extensions” if the table is going to be linked to the model (see “The retention policy: what exactly it deletes”).
  4. Use the storage report, which is updated daily, to find your largest tables, and shorten their period if you can (see “The three types, and who decides them”).
  5. Before changing a cardinality, read what the sibling page warns about (see “Relationships in Data Designer, or a standalone table”).
  6. Set the three data extension policies, and confirm that no active journey uses the table as its entry source before adding fields to it (see “The fields, and what cannot be undone” and step 6 of the example).

Official sources

Back to the knowledge base