# 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>" %}


---

# 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://docs.tailent.com/actions/tap-actions/database/database-query.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.
