This article explains the field definitions (such as Primary Keys and data types) for CSV files output by Reports and Data Extract Activities. It also outlines recommended settings for storing this data in Data Extensions or external databases, and provides strategies for updating data when no Primary Key exists.
Data output by Reports and Data Extract Activities is in CSV format (text). The file itself does not retain database schema definitions such as Primary Keys, data types, or data lengths.
Although the source data resides in a database, the application retrieves and processes it before outputting it to CSV. Consequently, the output may not strictly reflect the database definition, and there may not always be a key that guarantees uniqueness.
Based on the characteristics described above, consider the following settings when storing extracted data.
To ensure a smooth import process, we recommend the following settings:
Data Type: Select "Text" for all fields.
Length: Specify a sufficiently large size.
Required: Set all fields to "Nullable" (unchecked for Required).
Primary Key: Set to "None".
It is not necessary to replicate the Marketing Cloud database definition for the source data. Define fields flexibly according to your database requirements and consider performing data conversion during the import process if necessary. Note: Data types such as dates may require conversion to match the definitions of your destination database.
Data Type: Variable-length string (e.g., VARCHAR).
Primary Key: None.
If a Data Extension does not have a Primary Key, "Add" and "Update" options are unavailable during imports or Query Activities, preventing differential updates. To achieve this, consider one of the following three approaches:
Consolidate files beforehand: Merge multiple CSV files from extracts or reports into a single file before importing it into the Data Extension.
Process data to create a Primary Key: Modify the CSV file to include a column with unique values and designate it as the Primary Key.
Assume a Primary Key based on existing data: Identify a combination of fields that should be unique based on data output history and set them as the Primary Key.
Note: If you choose option 3 and data violating the Primary Key constraint is generated, you must manually process the data to remove the violation.
Similar to the content of this article, users often ask, "Which field is the Primary Key for Data Views?" Data Views do not have Primary Keys.
For more information, please refer to the following documentation:
Optimizing a SQL Query Activity
000393014

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.