Azure SQL Server error message - Query failed: The file exists

Dan Falcone 35 Reputation points
2023-09-07T12:31:03.0533333+00:00

I have a SQL database resource in Azure that I've been using for a few months. Using Azure Data Studio I can log in to my Azure SQL Server database with my user ID using Authentication Type "Azure AD - Universal with MFA Support", see all of the tables, views, etc. However when I attempt to perform a select query I get the following message:

Started executing query at Line 17

(1 row affected)

Query failed: The file exists.

Total execution time: 00:00:17.418

The query did find the correct amount of rows, however it shows the error "Query failed: the file exists" and does not show the results of the query.

There is also another user id that is querying the same database successfully using Azure Data Factory. Is there a problem with my user ID?

Thanks for your help!

Azure SQL Database
Azure
Azure

A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.

Azure Data Studio
Azure Data Studio

A cross-platform database tool for data professionals using on-premises and cloud data platforms on Windows, macOS, and Linux.

Locked Question. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Amira Bedhiafi 43,046 Reputation points MVP Volunteer Moderator
2023-09-07T13:03:26.24+00:00

The error you are getting is more common with filesystem operations. To confirm if the issue is specific to Azure Data Studio, you can try to execute the query using a different tool such as SQL Server Management Studio (SSMS). This way, you can ascertain if the issue is with Azure Data Studio or the Azure SQL Database.

Azure Data Studio might be logging more detailed error information. Check the logs or the output pane for any additional details regarding the error.

Ensure that your Azure Data Studio is up to date. An outdated version might have bugs that have been resolved in later versions.

Although you can see the tables and views, make sure your user has the correct permissions to perform the SELECT query on the specific table you are querying. Though it's not typical for a permissions issue to result in a "file exists" error, it's worth checking.

As you mentioned another user is querying the database successfully, try using that user's credentials in Azure Data Studio to check if the problem is specific to your user ID.

If Azure Data Studio is trying to write a temporary file somewhere (like for caching purposes) and encountering this error, you might want to inspect any associated storage accounts or configurations in Azure related to your SQL Database setup.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Niclas Vikström 0 Reputation points
    2026-08-24T07:32:38.71+00:00

    Hi! I got this error using Microsoft Management studio 19. Tried to reinstall and installed version 20 (since database is 16).
    Did not help. But then, based on this post and luck, i found some files Users/{Username}/AppData/local/temp that started with name ssm.... (had 5 files). After removing them, it worked.

    Was this answer helpful?

    0 comments No comments