---
title: "SQL-file"
canonical: "https://support.appfire.com/space/SQL/74318286/SQL-file"
format: markdown
---
> Macro (aura-html)

# Description

This macro has similar parameters as the [SQL Macro](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74320195) and behaves similarly in most cases. There are 2 primary reasons for using **sql-file**:

- **<span style="color: #000000">Security</span>**<span style="color: #000000"> — it can be secured separately from the other SQL macros. </span>
  - <span style="color: #000000">Using </span>[<span style="color: #000000">Macro Security for Confluence</span>](https://appfire.atlassian.net/wiki/spaces/CMSP)<span style="color: #000000">, more general users can be authorized to use this macro since the administrator controls what queries can be accessed.</span>
  - <span style="color: #000000">When not using </span>[<span style="color: #000000">Macro Security for Confluence</span>](https://appfire.atlassian.net/wiki/spaces/CMSP)<span style="color: #000000">, the administrator can disable the </span>**<span style="color: #000000">sql</span>**<span style="color: #000000"> and </span>**<span style="color: #000000">sql-query</span>**<span style="color: #000000"> macros and still allow the </span>**<span style="color: #000000">sql-file</span>**<span style="color: #000000"> macro since it has a fixed set of queries that can be run. </span>
- **<span style="color: #000000">Simplified File Access</span>**<span style="color: #000000"> — the modified parameter makes it easier to specify and read SQL from files.</span>

## <span style="color: #000000">Usage Parameters</span>

| **Parameter** | **Required** | **Default** | **Macro Browser Label** | **Description** |
| --- | --- | --- | --- | --- |
| Data Source  
(may be restricted) | :check_mark: |  | Data Source Name | <span style="color: #333333">Specify the Data Source name. It represents an application server defined Data Source or Data Source Profile defined by your administrator.</span> |
| file  
(may be restricted) | :check_mark: |  | File | File path in the configured **Confluence server home** directory under the **script** directory. |
| Output |  |  | Output format | Determines how the output is formatted:<br>- **HTML** — Generates HTML from the result set data. Data is HTML encoded unless encoding has been disabled.
- **wiki** — Generates and renders wiki markup from result set data. If the data might contain unintended wiki markup characters, set the **escape** parameter to true.
- **XHTML** (Pro Edition) — Generates and renders XHTML from result set data. Data is HTML encoded unless encoding has been disabled (**disableAntiXss**).
- **unrenderedWiki** (Pro Edition) — Generates wiki markup from result set data, similar to **wiki**, without rendering. Wraps with a **table-plus** macro suitable for copying to another system. |

For more information on Common SQL parameters, refer to [Working with SQL parameters - 9.x](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74323070/Working+with+SQL+parameters+-+9.x).

## Examples

> Macro (children)

## Explore SQL Parameters

The SQL Macro has dozens of built in parameters that you can explore and apply. 

![image](media://82817c7d-80d5-4633-82bf-1ed9686ca4ca)

###