Azure SQL DB created with '#' in name cannot be accessed nor deleted

Rory Patten 20 Reputation points
2025-01-03T13:43:15.95+00:00

I mistakenly created a database in Azure with a hash in the name e.g. 'MYDB_#BACKUP'.

When I attempt to access the database on the Azure portal to delete/rename it I get an error - 'Resource not found'.

I have tried:

  • Delete command using Azure CLI linux by name - no error displayed with verbose option but db still there when i run list command.
  • Delete command using Azure CLI linux by resource id - does not work - asks for api-version param even though I am providing it

I am being charged significant sums for this database that I cannot access so your assistance will be much appreciated!

Thanks!

Azure SQL Database
{count} votes

Accepted answer
  1. RahulRandive 10,066 Reputation points
    2025-01-03T19:28:29.9333333+00:00

    Hi @Rory Patten

    I was able to repro the issue. Created database with name MYDB_#BACKUP

    User's image

    To drop, you can use command drop database [MYDB_#BACKUP]

    User's image

    Post then, you can refresh the database list from SSMS. The database is now gone

    Thanks

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Vijayalaxmi Kattimani 905 Reputation points Microsoft Vendor
    2025-01-03T16:35:28.8+00:00

    Hi @Rory Patten,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    As we understand that, you are unable to delete an existing database, but with persistence and the right approach, you can achieve it.

    Please try to follow the below mentioned steps in order to resolve your issue.

    1. Open the Azure portal and log in with the proper credentials.
    2. Go to SQL databases.
    3. Select the database which you want to delete and click on the overview.
    4. After that, a delete button will display which is shown below figure.
    5. 1st
    6. Click on the delete button and after that, a new pop-up will come from the right-hand side.
    7. In the textbox, type the database name which you want to delete and click on the delete button.
    8. After that, it will take some time and the database will be permanently deleted from the server.

    For more information, please refer to the below mentioned link.

    https://learn.microsoft.com/en-us/sql/relational-databases/databases/delete-a-database?view=sql-server-ver16#next-steps

    If this does not help, please file a support ticket for deeper investigation and do share the SR# with us? In case if you don't have a support plan please let us know here.

    I hope, This response will address your query and helped you to overcome on your challenges.

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.