# Stored Procedures

## Executing Stored Procedures

appRules supports the execution of stored procedures.   For database engines that support stored procedures, appRules includes the ExecuteStoredProcedure activity for executing stored procedures.  If the stored procedure returns records, the records and the fields they contain can be read from the database and utilized in appRules just like any other records and fields.

### ExecuteStoredProcedure Activity

For example, to execute a stored procedure in SQL Server, drag and drop the ExecuteStoredProcedure activity from the SQL Server Toolbox on to the designer and configure the properties.

![](https://1923141441-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFjmFrZ8sef1J7qkr6H%2F-MHztE-IzrFF7MZPSIH2%2F-MHztRnOQp9ND3mbGS59%2Fimage.png?alt=media\&token=accaf41f-b970-4313-a327-9a805cbf04d9)

| Property              | Description                                                                                                                                                                                                                  |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Datasource            | Click to property button to configure or select the data source                                                                                                                                                              |
| StoredProcedureType   | Select the type of stored procedure indicating the type of result returned.                                                                                                                                                  |
| StoredProcedure       | The name of the stored procedure                                                                                                                                                                                             |
| StoredProcedureFields | This collection property specifies the data fields in the stored procedure. Only the field name and field type is required when defining the field.  The field name must match the column name used in the stored procedure. |
| StoredProcedureParams | If the stored procedure uses parameters, specify them with this collection property.                                                                                                                                         |
| AutoLoad              | Use FirstRecord to read the first record from the stored procedure or AllRecords to read all records.                                                                                                                        |
| RecordCount           | Design time property to get the record count if the stored procedure returns records.                                                                                                                                        |


---

# 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.appstrategy.com/apprules-r-documentation/appendix/miscellaneous/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.
