# SQL Server - Export query result action
# Export query result
This action executes a SQL query and exports the results as a CSV file. The CSV file is uploaded to a local directory or a cloud storage like an S3 bucket.
If the CSV file is uploaded to a local directory, the query results are processed and stored locally. This means that your data never leaves your secure network.
On-prem profile configuration
Remember to configure a staging area in your on-prem agent profile. Learn how to setup a staging area in the OPA server profile.
Export query result action
|SQL||A valid SQL query.|
|Column delimiter||Choose a delimiter character. CSV files typically use comma.|
|Upload URL||Export the CSV file to this URL. Generate this url using On-prem files or Amazon S3.|
The output of this action contains metadata about the export action.
|Number of rows exported||The number of rows exported.|
|Column names||Column headers in the CSV file.|
CSV file content
This action does NOT return the CSV file content.