# run\_sql\_file

&#x20;`run_sql_file` function has 1 variants:

{% tabs %}
{% tab title="Variant 1" %}
#### Description <a href="#description" id="description"></a>

1. &#x20;`run_sql_file` function opens and execute all sql commands in the file sequentially.
2. Each sql commands must end wih ';' character.
3.  If error occured during execution, the function execution is stopped immediately and

    database specific error message is returned.
4. &#x20;Database script file path is relative to the `SodiumServer.Exe` file.
5. &#x20;Database script file can contain DML or DDL statements but cannot contain `begin` and `end` block since Sodium executes each command separated by ';' character.

#### Declaration <a href="#declaration" id="declaration"></a>

```
char run_sql_file(char filePath);
```

#### Parameters <a href="#parameters" id="parameters"></a>

`char filePath` Sql script file full path.

#### Return Value <a href="#return-value" id="return-value"></a>

Returns error message if any error message occured.

#### Example <a href="#example" id="example"></a>

```
void dual.htsql_demo_installation() {
        char ret = run_sql_file('htsql_demo_installation.sql');
        if (ret is not null) then
                message('Error occured : ' || ret);
        else
                message('Sodium demo schema and objects has been created.');
        end if;
}
```
{% endtab %}
{% endtabs %}
