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

# MS SQL

<Frame>
  <img class="image-center" src="https://mintcdn.com/cognigy-15abf2ba/eCWTpPMMSEqv9wTC/_assets/ai/develop/node-reference/services/run-sql-query.png?fit=max&auto=format&n=eCWTpPMMSEqv9wTC&q=85&s=c61f6fa3278d41e232c633e592a3378f" alt="MS SQL Node configuration panel" style={{ width: 'auto' }} width="418" height="112" data-path="_assets/ai/develop/node-reference/services/run-sql-query.png" />
</Frame>

## Description

The SQL Node lets you run queries, transactions, or stored procedures on MS SQL Server.

## Run Query

Runs a single SQL query statement.

| Parameter         | Type          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MS SQL Connection | List          | Select MS SQL database connection. To create a new connection, click <img src="https://mintcdn.com/cognigy-15abf2ba/3f0tglC4DBfZZ5qq/_assets/icons/plus-simple.svg?fit=max&auto=format&n=3f0tglC4DBfZZ5qq&q=85&s=a1d4baa0b2b8eaa5f6c132bebbe30dfc" alt="plus" width="16" height="16" data-path="_assets/icons/plus-simple.svg" />. |
| SQL Query         | CognigyScript | Enter a valid SQL query in the Query field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

<AccordionGroup>
  <Accordion title="Result Storage">
    | Parameter                 | Type          | Description                                                                                                                         |
    | ------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
    | Where to store the result | List          | <ul><li>**Input** — stores the result in the Input object.</li><li>**Context** — stores the result in the Context object.</li></ul> |
    | Input Key to store Result | CognigyScript | Enter the key where the result should be stored.                                                                                    |
  </Accordion>

  <Accordion title="Advanced">
    | Parameter     | Type   | Description                                                                    |
    | ------------- | ------ | ------------------------------------------------------------------------------ |
    | Stop on Error | Toggle | Lets you configure whether to stop Flow execution when an error occurs or not. |
  </Accordion>
</AccordionGroup>

## Run Transaction

Runs a transaction.

| Parameter         | Type          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MS SQL Connection | List          | Select MS SQL database connection. To create a new connection, click <img src="https://mintcdn.com/cognigy-15abf2ba/3f0tglC4DBfZZ5qq/_assets/icons/plus-simple.svg?fit=max&auto=format&n=3f0tglC4DBfZZ5qq&q=85&s=a1d4baa0b2b8eaa5f6c132bebbe30dfc" alt="plus" width="16" height="16" data-path="_assets/icons/plus-simple.svg" />. |
| Query             | CognigyScript | Enter a valid SQL transaction query in the Query field. You do not need to add the "BEGIN TRANSACTION" and "COMMIT" fields, since this will be done implicitly. If you want to work with Try / catch blocks and do more advanced transactions with rollbacks, use [Run Query](#run-query) instead.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

<AccordionGroup>
  <Accordion title="Result Storage">
    | Parameter                 | Type          | Description                                                                                                                         |
    | ------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
    | Where to store the result | List          | <ul><li>**Input** — stores the result in the Input object.</li><li>**Context** — stores the result in the Context object.</li></ul> |
    | Input Key to store Result | CognigyScript | Enter the key where the result should be stored.                                                                                    |
  </Accordion>

  <Accordion title="Advanced">
    | Parameter     | Type   | Description                                                                    |
    | ------------- | ------ | ------------------------------------------------------------------------------ |
    | Stop on Error | Toggle | Lets you configure whether to stop Flow execution when an error occurs or not. |
  </Accordion>
</AccordionGroup>

## Run Stored Procedure

Runs a stored procedure. The stored procedure must exist in the database specified under Connection.

| Parameter             | Type          | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MS SQL Connection     | List          | Select MS SQL database connection. To create a new connection, click <img src="https://mintcdn.com/cognigy-15abf2ba/3f0tglC4DBfZZ5qq/_assets/icons/plus-simple.svg?fit=max&auto=format&n=3f0tglC4DBfZZ5qq&q=85&s=a1d4baa0b2b8eaa5f6c132bebbe30dfc" alt="plus" width="16" height="16" data-path="_assets/icons/plus-simple.svg" />. |
| Stored Procedure Name | CognigyScript | Enter the name of the stored procedure.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Inputs                | JSON          | Enter an array of input parameters of your stored procedure as defined in the database. You can forward parameters from the Context to the database, for example. Parameters must be specified in an array of objects that define the input parameter in the following format: `{name,value,type}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Outputs               | JSON          | Enter an array of output parameters of your stored procedure as defined in the database. You can forward parameters from the database to the Context, for example. Parameters must be specified in an array of objects that define the output parameter in the following format: `{name,value,type}`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

<AccordionGroup>
  <Accordion title="Result Storage">
    | Parameter                 | Type          | Description                                                                                                                         |
    | ------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
    | Where to store the result | List          | <ul><li>**Input** — stores the result in the Input object.</li><li>**Context** — stores the result in the Context object.</li></ul> |
    | Input Key to store Result | CognigyScript | Enter the key where the result should be stored.                                                                                    |
  </Accordion>

  <Accordion title="Advanced">
    | Parameter     | Type   | Description                                                                    |
    | ------------- | ------ | ------------------------------------------------------------------------------ |
    | Stop on Error | Toggle | Lets you configure whether to stop Flow execution when an error occurs or not. |
  </Accordion>
</AccordionGroup>
