---
schema_version: "1"
id: cea9765b6cee9703a3df26eb6c53fe1e8ba87e6e8b1bcf7b6088e3a8e7868452
title: UpdateDE()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/references/data-extension/mc-ampscript-reference-data-extension-update-de.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-update-de.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2ec0efaef6b7c75ec03759342473770559046a223b742ed9583fc0fce31e9109
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# UpdateDE()

Updates data in a data extension. This function doesn’t return any output.

You can use this function to update data in a data extension in an email. Use the [UpdateData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-update-data.md) function to update rows in CloudPages, landing pages, microsites, and SMS messages in MobileConnect.

## Availability

<table>
  <tr>
    <td>Marketing Cloud Engagement</td>
    <td>✅ Yes</td>
  </tr>
  <tr>
    <td>Marketing Cloud Next</td>
    <td>❌ No</td>
  </tr>
</table>

## Syntax

```
UpdateDE(dataExt, columnValuePairs,
         searchColumnName1, searchValue1,
         [searchColumnName2, searchValue2,]
         columnToUpdate1, updatedValue1,
         [columnToUpdate2, updateValue2])
```

The `UpdateDE()` function has six parameters:

- `dataExt` (string): Required. The name of the data extension that contains the data to update.
- `columnValuePairs` (number): Required. The number of column and value pairs for the function to match against.
- `searchColumnName1` (string): Required. The name of the column to search for the data to update.
- `searchValue1` (string): Required. The value that the function uses to determine which row to update. You can specify multiple column and value pairs to match against.
- `columnToUpdate1` (string): Required. The column that contains the data to update.
- `updatedValue1` (string): Required. The data to update in the specified column. You can specify multiple column and value pairs to update.

## Usage

To use the function, first pass it the name of the data extension that contains the data you want to update. Next, pass it the name of the column to search to find the row that you want to update, and the value that identifies the row to update. Finally, pass it the name of the column that you want to update the data in, and the value that you want to update.

### Updating a Single Value

In this example, a data extension called "Flights" contains the data in this table.

| FlightId | Origin | Dest | Price | PerBagSurcharge |
| -------- | ------ | ---- | ----- | --------------- |
| 1        | IND    | NYC  | 100   |                 |
| 2        | IND    | LAX  | 200   |                 |
| 3        | IND    | SEA  | 500   | 25              |
| 4        | ORD    | SEA  | 525   | 10              |
| 5        | ORD    | LAX  | 400   |                 |
| 6        | SEA    | SAN  | 300   |                 |
| 7        | SEA    | ATL  |       | 10              |
| 8        | ATL    | AUS  | 350   | 10              |
| 9        | STL    | KCA  |       | 5               |
| 10       | IND    | ATL  | 125   |                 |

To update the `Price` value for `FlightId` 10, use this function.

```
%%[
  Var @updatedFlight
  Set @updatedFlight = UpdateDE("Flights", 1, "FlightId", 10, "Price", 225)
  Output(v(@updatedFlight))
]%%
```

The function returns `1`, indicating that it updated one row. The data extension now contains this data.

| FlightId | Origin | Dest | Price | PerBagSurcharge |
| -------- | ------ | ---- | ----- | --------------- |
| 1        | IND    | NYC  | 100   |                 |
| 2        | IND    | LAX  | 200   |                 |
| 3        | IND    | SEA  | 500   | 25              |
| 4        | ORD    | SEA  | 525   | 10              |
| 5        | ORD    | LAX  | 400   |                 |
| 6        | SEA    | SAN  | 300   |                 |
| 7        | SEA    | ATL  |       | 10              |
| 8        | ATL    | AUS  | 350   | 10              |
| 9        | STL    | KCA  |       | 5               |
| 10       | IND    | ATL  | 225   |                 |

### Updating Multiple Values in One Row

You can use the `UpdateDE()` function to update more than one column in a single row in one operation. To update multiple columns, provide one set of search criteria for each column that you want to update.

This example uses a data extension called "Flights2" that contains the data in this table.

| FlightId | Origin | Dest | Price | PerBagSurcharge |
| -------- | ------ | ---- | ----- | --------------- |
| 1        | IND    | NYC  | 100   |                 |
| 2        | IND    | LAX  | 200   |                 |
| 3        | IND    | SEA  | 500   | 25              |

Use this code to update the `Dest`, `Price`, and `PerBagSurcharge` fields for `FlightId` 1.

```
%%[
  Var @updatedFlight
  Set @updatedFlight = UpdateDE("Flights2", /* Data extension that contains the data to update */
                                  3, /* Number of columns to match against */
                                  "FlightId", 1, /* First set of search criteria */
                                  "Origin", "IND", /* Second set of search criteria */
                                  "Dest", "NYC", /* Third set of search criteria */
                                  "Dest", "JFK", /* Column name and updated value for first update */
                                  "Price", 75, /* Column name and updated value for second update */
                                  "PerBagSurcharge", 10) /* Column name and updated value for third update */
  Output(v(@updatedFlight))
]%%
```

The function returns `1`, indicating that it updated one row. The data extension now contains this data.

| FlightId | Origin | Dest | Price | PerBagSurcharge |
| -------- | ------ | ---- | ----- | --------------- |
| 1        | IND    | JFK  | 75    | 10              |
| 2        | IND    | LAX  | 200   |                 |
| 3        | IND    | SEA  | 500   | 25              |

## Errors and Troubleshooting

If you receive errors or notice incomplete updates when you use this function, consider the following factors:

- If you specify a value for the `columnValuePairs` parameter that doesn’t agree with the number of matching criteria in the function, the function returns an exception.
- If you specify a column name for the `searchColumnName` parameter that doesn’t exist in the specified data extension, the function returns an exception.
- If you specify a value for the `searchValue` parameter that isn’t found in the specified column, the function doesn’t update any data and returns `0`.
- If you specify a value for the `updatedValue` parameter that is of a different data type than the column that you specified in the `columnToUpdate` parameter, the function doesn’t update any data and returns `0`. For example, if you pass a numeric value, but the column contains string data, the function doesn’t update the data.
- If the number of search parameters (`searchColumnName` and `searchValue`) doesn’t equal the number of update parameters (`columnToUpdate` and `updatedValue`), the function updates the columns that you provided search parameters for. For example, if you provide two search parameters and three update parameters, the function only implements the first two update parameters. You can repeat the same update parameters multiple times if necessary.

## See Also

- [UpdateData()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-data-extension/mc-ampscript-reference-data-extension-update-data.md)
