# 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/zEifS4h8yurLAAwiGNX2/blobs/o5zHDoyqGYtNU4xz4fNM/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/zEifS4h8yurLAAwiGNX2/blobs/tj1JCPXdVTEXkSTIUcr5/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/zEifS4h8yurLAAwiGNX2/blobs/eqmyI7NKva2p3YbHngVR/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/zEifS4h8yurLAAwiGNX2/blobs/69Vmfo7Qr7YWlnM6mQDu/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/zEifS4h8yurLAAwiGNX2/blobs/UGm8vRBNkI9myvcDvB30/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.
