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

# ExecSQLStatementSource

The **ExecSQLStatementSource** function executes an **aSQL** query against the database, and returns either **True** or **False** depending on the success of the query.

The **SQL** query is executed against a **DB Connection** on the **Source** of the **Map**.

This is commonly used with **SQL** statements that do not return a dataset e.g. Insert or Update.

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

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

An example of the use.

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