# Stored Procedures

Stored procedures are stored in a relational database.  A stored procedure query is created by chaining methods together from the root of `wire.data.procedure`.  These methods populate the properties of a `wire.data.StoredProcedure` object.  This object is then passed through the data source to the [service provider](/wirebootstrap/connecting-to-data/data-connectors.md) for processing.

To check for service provider support for stored procedures, use the `allow.storedProcedure` attribute on the [DataSource](/wirebootstrap/reference/wire.data/wire.data.datasource.md) object servicing the query request. &#x20;

## Stored Procedure Query

The following will execute a stored procedure called `spGetUsers` in the database and return the results to the data source.

```javascript
const query = wire.data.procedure("spGetUsers");
```

The following adds two parameters to the stored procedure query.

```javascript
const query = wire.data.procedure("spGetUsers")
    .param("Active", true)
    .param("Domain", "usa.domain");
```

Visit the data source service provider documentation for details on support for stored procedure queries.


---

# 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.wirebootstrap.com/wirebootstrap/creating-queries/stored-procedures.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.
