# Run SQL File

The *Run SQL File* task runs the SQL code inside a file of .sql extension as part of a workflow.

<figure><img src="https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FsctLwI6vFt3liNFMvLRB%2F01-SQL-File-Object.png?alt=media&#x26;token=e75365f4-9c5f-4add-badc-ede69c213d2d" alt=""><figcaption></figcaption></figure>

To use a *Run* *SQL* *File* task, drag-and-drop the *Run SQL File* 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://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FZmxfQJoZUhRoExSwfxmi%2F02-SQL-File-Click.PNG?alt=media\&token=5c18f541-93af-40fe-afa8-e79eb89c9330)

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

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FzTqPXD3iXJLLH5wZx6qz%2F03-SQL-File-DB-Conn.PNG?alt=media\&token=8902b82e-da77-4b05-be23-89c145e9bfec)

Astera offers native connectivity to several databases and applications. 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://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FwmbMQTkF7ucyYdIx9R0E%2F04-SQL-File-DB-Conn-Options.png?alt=media\&token=5c89a00a-04c6-4540-974e-3659bc51680b)

To establish a connection to a data provider, fill in the credentials, which are *User Id*, *Password*, *Server Name*, *Database*, and *Schema* for SQL Server.

Next is the *Run Sql File Properties* window.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FLXbwmxbJUmyfMEbEnEil%2F05-SQL-File-Properties.PNG?alt=media\&token=3fb163a8-9e7e-4223-86e6-26c8f44d70c1)

*SQL File Path*: Specify the path to the SQL file that you want to execute through this task.

Next is the *Config Parameters* screen. This is where users can set up variable parameters to indicate a run-time change for values in the list on the screen.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FDP0i8M1OkK9jKpmXWIwp%2F06-SQL-File-Config-Para.PNG?alt=media\&token=10f990bb-bd32-459a-82f7-4f80c973d447)

Click *OK* to close the window. You can now execute this task as part of the workflow.

This concludes the configuration and working of the *Run SQL File* workflow task in Astera.
