---
title: "Parameterized SQL queries in the cloud"
canonical: "https://support.appfire.com/space/SUPPORT/3549496315/Parameterized%20SQL%20queries%20in%20the%20cloud"
format: markdown
---
Following the Confluence Data Center-to-Cloud migration, parameterized SQL queries may fail with the following error: “Incorrect syntax near the question mark (?)”. Parameterized queries that worked in Data Center are currently not supported in Cloud. Follow the workaround to replace the parameter placeholders in queries with actual values.

> Macro (toc)

## Prerequisites and setup

1. Download the attached script  and open it in a browser. The script will display the graphical user interface.
2. Enter the email address associated with your Confluence Cloud account and an API token generated for the same instance. Follow these steps to generate an API token:
  1. Navigate to [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
  2. Create a new token:
  3. Copy the generated token and use it in the authentication window opened in step 1.
3. After successful authentication, the following window will appear:
  1. Change the Confluence base URL to the URL of your test instance.
  2. Give access to the CORS DEMO API by clicking <span style="color: #0747a6">corsdemo</span> from the Error section and allowing temporary access.
  3. Grant temporary access to the CORS DEMO API by selecting **Request temporary access to the demo server**.
  4. Return to the main script page and refresh it.
4. On refresh, it will fetch the spaces from the specified Confluence instance and will show a success message as below:

Once setup is complete, there are two ways to replace the question marks in SQL queries stored in attachments:

> Macro (toc)

- Step-by-step mode: Update one SQL query at a time by selecting one space, page, and attachment.
- Direct input mode: Update multiple SQL queries from multiple attachments in one operation.

For bulk operations, process the queries in batches of five or ten to reduce the risk of errors.

# **Step-by-step mode**

  1. Select the Space, Page, and Attachment containing the SQL query.
  2. It will show the SQL query from the attachment as below:
  3. Now, to replace the '?', fill the parameter values in the “Replacement values“ box on the right side. As mentioned, you can either use the comma-separated values or each value on a new line, as shown in the window:

# **Direct Input Mode**

  1. Use the  to update the parameter values for multiple queries.
  3. You can use this code block multiple times, for each attachment from different pages.
    replace:
    Space_key -> actual space key
    page_name -> actual page from space:  
attachment_name -> actual attachment name
    replacement: enter parameter value or comma-separated values as applicable.
  4. Once config.json file is updated , upload it to the page refer recording for the same :