---
url: >-
  /statelake/scripting-reference/functions-and-procedures/database-functions/execsqlstatementdest.md
---

# ExecSQLStatementDest

This **ExecSQLStatementDest** function executes an **aSQL** query against the database, and returns either a **True** or **False**, depending on the success of the query. This is commonly used with **SQL** statements that do not return a dataset eg Insert or Update.

The **SQL** query is executed against a **DB Connection** on the **Destination** of the **Map**, and will become part of the default **SQL Transaction** that is open against the **Destination** database.

In terms of process management, this means that any queries will be rolled back if the **Action** fails.

**aDBIndex** indicates which of the **DB Connections** is used based on its zero based index.

Declaration: function ExecSQLStatementDest(const aSQL: string; aDBIndex : integer): boolean;

Example

```pascal
procedure OnMapEvent(var Value:Variant);
begin
  Value := ExecSQLStatementDest('update dr_accs set name='cam' where accno=1',0);
end;
```
