DeleteDE()

Deletes rows from a data extension. This function doesn’t return any output.

You can use this function to delete rows from a data extension in an email. Use the DeleteData() function to delete rows in CloudPages, landing pages, microsites, and SMS messages in MobileConnect.

The DeleteDE() function has three parameters:

  • dataExt (string): Required. The name of the data extension that contains the data you want to delete.
  • columnName1 (string): Required. The name of the column to search for the data you want to delete.
  • valueToDelete1 (string): Required. The value that the function uses to determine which row to delete.

You can delete multiple rows in the same operation by appending column names and field values to the end of the function.

To use the function, first pass it the name of the data extension that contains the data that you want to delete. Next, pass it the name of the column to search for the data that you want to delete. Finally, pass the value that identifies the row you want to delete.

Imagine you have a Flights data extension that contains the data in this table.

OriginDestPricePerBagSurcharge
INDNYC100
INDLAX200
INDSEA50025

To delete the row in which the value in the Dest column is "LAX", use this function.

The function deletes the specified row, leaving this data in the data extension:

OriginDestPricePerBagSurcharge
INDNYC100
INDSEA50025

You can also use this function to delete multiple rows based on more than one set of criteria.

In this example, the Flights data extension from the earlier example has been expanded to include more data.

OriginDestPricePerBagSurcharge
INDNYC100
INDLAX200
INDSEA50025
ORDSEA52510
ORDLAX400
SEASAN300
SEAATL10
ATLAUS35010
STLKCA5
STLATL200

To delete the rows in which the value in either the Origin or the Dest column is "ATL", use this function.

The function deletes the specified rows, leaving this data in the data extension:

OriginDestPricePerBagSurcharge
INDNYC100
INDLAX200
INDSEA50025
ORDSEA52510
ORDLAX400
SEASAN300
STLKCA5