> For the complete documentation index, see [llms.txt](https://docs.tailent.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tailent.com/actions/tap-actions/database/database-query.md).

# Database Query

This action can be used to run queries on a database and extract desired data.

## Properties<br>

![](/files/RvQLvN7j4R94uSFjvhOd)

### ‌Input

![](/files/efdEJm77lhkKWmXxHb8G)

* **Query:** The query which will be executed on the given tatabase connection.
* **Database Connection:** The DatabaseConnection object which will be used to interract with the SQL Server.

### Output

![](/files/4hZNpcadjfxmW4SuvUfR)

* **Result:** The resulting DataTable object returned by the query.

{% hint style="info" %}
**Note:** This object **must** have the **Variable Type** set to **DataTable**.
{% endhint %}

### Misc

![](/files/XgYOz6iQPRvuuxcvPjaJ)

* **Display Name**: action display name in your implementation project.
* **Wait Before**: number milliseconds robot to wait before executing the action.
* **Wait After:** number milliseconds robot to wait until moving to the next action.
* **Abort on Error**: True/False.
* **Retry Times**: Specifies the number of times to retry an action if it doesn't end successfully. Default value 0 (no retry); Use -1 if you want to retry indefinitely.

## **Use Case**

### **Potential Use Cases** <a href="#potential-use-cases" id="potential-use-cases"></a>

* Run querries on a database to extract customers based on the specified requirements and insert them in a CRM.

{% embed url="<https://youtu.be/9lylvB7daaU>" %}
