---
title: "Calling Stored Procedure From Flow to Write Data"
slug: "calling-stored-procedure-flow-write-data"
description: "This document shows how to create a flow that utilizes Stored Procedures from MSSQL, to write to a database from Decisions. By using the Add Procedure Action, users are able to call on the Stored Procedure to interact with the associated database from Decisions. "
tags: ["MSSQL", "stored procedure"]
updated: 2025-09-02T18:30:21Z
published: 2025-09-02T18:30:21Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Stored Procedure in Flows

| Feature Details |
| --- |
| **Modified in Version** | 8.18 |
| **Location** | System > Integration > Databases |

## Overview

Stored Procedures are queries that run in MSSQL with an EXEC command. Stored Procedures can perform queries on the database table to update, add, delete, select, or edit data. Stored Procedures can be integrated to create steps that can execute the Stored Procedure and move the input values from the Flow to the database table.

Although this document refers to MSSQL throughout, everything here applies to MYSQL. This includes functionality like extracting out or inout variables in a stored procedure.

> [!CAUTION]
> Errors with MSSQL
> 
> Please partner with a database or system administrator or use internet resources to configure the Stored Procedure in MSSQL. If there are errors that occur while creating a Stored Procedure, please use [Microsoft's Stored Procedures](https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/stored-procedures-database-engine?view=sql-server-ver15) support documentation. Decisions cannot troubleshoot MSSQL operations outside of its relation to the Decisions platform. Ensure the testing environment is appropriate to proceed.

### Prerequisites

- MSSQL Database

> [!NOTE]
> PostgreSQL Integration
> 
> Decisions use [Functions](https://www.postgresql.org/docs/current/sql-createfunction.html) rather than Procedures for PostgreSQL when setting up a Stored Procedure for a PostgreSQL integration.

---

## Adding Store Procedure to Decisions

In this example, a Stored Procedure has been created that adds a new person to the specified database table. To add the example store procedure, run the following SQL query in the connected database.

```sql
CREATE PROCEDURE AddPerson (
@PersonID text,
@FirstName text,
@Lastname text,
@DOB datetime) AS

Begin
	INSERT INTO dbo.person ([PersonID], [FirstName], [Lastname], [DOB])
			Values (@PersonID, @FirstName, @Lastname, @DOB)
			
			END
			GO
```

1. Navigate to **System (gear icon) > Integrations > Databases.**
2. From the top action panel, Click ADD PROCEDURE. On the **Add Procedure** window, choose the appropriate **Procedure Name** from the drop-down menu.
3. The **Procedure Definition Name** will automatically populate. In the **All Parameters** window, inputs appear configured in the Stored Procedure, where the data type of the expected value also appears.
4. If desired, select the **Returns Data** option to add input parameters for creating a Data Structure when running the Stored Procedure. Click OK.

![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2024-08-06_16h47_58(2).png)

---

## Store Procedure Steps Configurations

Store procedure steps are located in the [Toolbox](https://documentation.decisions.com/docs/searching-the-step-catalog) > Integration > Database > [DatabaseName] > Exec dbo.[StoreProcedureName]. The following table describes the settings available on the Store Procedure Steps.

| Environment Setting | Description |
| --- | --- |
| Use Transaction | This setting allows users to manage transactions associated with the stored procedure execution. - Transaction Data: This is a new input exposed when users enable the setting that accepts two settings: - Commit Unresolved Transactions: This option determines whether unresolved transactions should be committed or rolled back. - Transaction Name: This field specifies the name of the transaction. |
| Run in Defined Environment | This setting, when enabled (as it is by default), the stored procedure will be executed in a predefined or default environment. |
| Run without Transaction | If transactions are not needed for a specific stored procedure, this setting allows them to be excluded. |
| Override Connection String | This setting, when enabled, allows users to provide a custom database connection string instead of using the default connection. |

---

## Using Store Procedure Steps in a Flow

1. In a Designer Project, click [CREATE FLOW](/v9/docs/create-flows).
2. In the **Toolbox** panel, navigate to **INTEGRATION > DATABASE > [DATABASENAME]** and attach the **Exec public.AddPendingJob** to the **Start**and **End**steps.

![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/2025-06-23_12h18_25.png)

### Debug

1. On the top action bar, click **Debug**.
2. Click START DEBUGGING.
3. Open MSSQL and use a select statement or the menu command to show the updated database table.
4. The inputs mapped to the Exec Flow step were recorded to the database table as the Stored Procedure was called from the Flow.

![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1647544066801.png)

---

## Feature Changes

| Description | Version | Release Date | Developer Task |
| --- | --- | --- | --- |
| Added a new setting on the Store Procedure Steps to Run without Transaction | [8.18](https://documentation.decisions.com/v99/docs/version-818x-release-notes) | January 2024 | [DT-026523] |

---

For further information on Integrations, visit the [Decisions Forum](https://community.decisions.com/categories/Integrations).
