# Run SQL Script

{% embed url="<https://youtu.be/j_9UQb2ipws?si=Vpg8AOz28dCz5NdA>" %}

The *Run SQL Script* task provides flexibility to write a SQL code within Astera and execute it as part of a workflow.

<figure><img src="https://content.gitbook.com/content/ZSZJ1eFyVv71eDI5hU45/blobs/FmISNZNC7BBxFaetsM47/01-Run-SQL-Script-Object.PNG" alt=""><figcaption></figcaption></figure>

To use a *Run SQL Script* task, drag-and-drop the *Run SQL Script* task object onto the workflow designer. Configure the object by right-clicking on the object’s header and selecting *Properties* from the context menu.

![](https://content.gitbook.com/content/ZSZJ1eFyVv71eDI5hU45/blobs/B8fgNPlO44rvN00VUqvZ/02-Run-SQL-Script-Click.PNG)

A *Database Connection* window will open, as shown below. This is where we will configure a connection with the database.

![](https://content.gitbook.com/content/ZSZJ1eFyVv71eDI5hU45/blobs/NTOPCbu7ZwrXL4DZQrif/03-Run-SQL-Script-DB-Conn.PNG)

To connect to a database, click on the drop-down menu next to the *Data Provider* field and select a data provider from the list.

![](https://content.gitbook.com/content/ZSZJ1eFyVv71eDI5hU45/blobs/JT0HlBHxHC6pJnNZz9d9/05-SQL-Script-DB-Conn-Options.png)

To establish a connection to a data provider, fill in the credentials such as *User Id*, *Password*, *Server Name*, *Database*, and *Schema*.

The next screen is the *Run Sql Properties* screen.

![](https://content.gitbook.com/content/ZSZJ1eFyVv71eDI5hU45/blobs/T51vnTCHpnb1FAvUyfFk/04-Run-SQL-Script-Properties.PNG)

In the SQL Statement box, enter the SQL code. This code will be executed by the *Run SQL Script* task.

Once you have added the SQL script, click *OK* to close the window.

This concludes the working of the *Run SQL Script* object in Astera.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.astera.com/astera-data-stack-v11/workflows/run-sql-script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
