Create a Data Extension

Use a data extension to store information about your subscribers in Marketing Cloud.

How To Create a Data Extension

This example creates a data extension to import or store data. After the data extension is created, associate it with an import definition. This example maps EmailAddress field of the data extension to Marketing Cloud field EmailAddress to create a data extension used to store the audience of an email send.

While you can create a data extension with an external key larger than 36 characters, doing so may cause problems when using the data extension in conjunction with other processes (especially if working with the UI, which truncates the external key to the first 36 characters). Limit your data extension external keys to 36 characters to help ensure all further processes function correctly.

Sample .NET Code

Sample PHP Code

Sample Java Code (Axis 1.4)

This sample code demonstrates how to create a data extension using the subscriber key feature:

Sample Ruby on Rails Code

Sample Ruby on Rails Code for Create a Sendable Data Extension

Sample SOAP Create Request

Sample SOAP Create Response

Sample SOAP Request with Non-Nullable Fields

The SOAP envelope below creates a data extension with a non-nullable field by including IsPrimaryKey and IsRequired values.

Sample SOAP Create Request Using Different Field Types

The sample SOAP envelope below includes an example of data extension field types.

Sample SOAP Request Creating a Data Extension with Data Retention Options

Sample SOAP Request Setting Decimal Field Types in a Data Extension

When creating a field with the Decimal data type in a data extension, you must set the precision and the scale of the field.

Sample SOAP Request Creating a Date Value in a Date-type Field

Note that the time must be passed in 24-hour format.