# 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](https://docs.wirebootstrap.com/wirebootstrap/connecting-to-data/data-connectors) for processing.

To check for service provider support for stored procedures, use the `allow.storedProcedure` attribute on the [DataSource](https://docs.wirebootstrap.com/wirebootstrap/reference/wire.data/wire.data.datasource) 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.
