> For the complete documentation index, see [llms.txt](https://docs.wirebootstrap.com/wirebootstrap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wirebootstrap.com/wirebootstrap/creating-queries/stored-procedures.md).

# 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.
