Share via

Azure SQL - can't drop system versioned tables

Vitalii Bohachov 0 Reputation points
2025-02-26T09:06:45.93+00:00

Hello.

I'm can't drop system versioned tables in master db in Azure SQL

I have a docs - https://learn.microsoft.com/en-us/sql/relational-databases/tables/stopping-system-versioning-on-a-system-versioned-temporal-table?view=azuresqldb-current

but request

ALTER TABLE dbo.Employees
SET (SYSTEM_VERSIONING = OFF);

returns an error: Msg 13538, Level 16, State 3, Line 1

You do not have the required permissions to complete the operation.

How I can delete this tables?

Azure SQL Database

5 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 21,156 Reputation points Microsoft Employee Moderator
    2025-03-27T23:12:50.7066667+00:00

    Vitalii Bohachov Thank you for being patient while working on this issue.

    We investigated and confirmed that this is a bug. We will be making repairs to avoid this problem in the future. Currently, a system-versioned table created in the master database on a logical SQL server cannot be dropped.  Thank you for pointing this out.

    We updated documentation to clarify that creating tables in the master database on a logical SQL server isn't supported. https://learn.microsoft.com/en-us/azure/azure-sql/database/transact-sql-tsql-differences-sql-server?view=azuresql#t-sql-syntax-statements-with-partial-differences

    We can drop it at the back end for you.

    User's image

    Regards,

    Oury

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Erland Sommarskog 134.3K Reputation points MVP Volunteer Moderator
    2025-03-14T15:18:24.94+00:00

    I've done some more research, and it looks like you are stuck with the beard in the letterbox as we say in Swedish.

    I assume that your scenario is that you mistakenly created this temporal table in master and you want to drop it. But you can't drop a temporal table directly, you first need to disable system versioning. Unfortunately, this requires CONTROL permission, as discussed at https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-table-security?view=sql-server-ver16#security-principles. And as we have concluded you only have ALTER and VIEW DEFINITION on the table.

    As for why you only have these permissions despite you are server admin, this seems to be by design. I see the same thing on my Azure SQL Servers. For a normal table, it is not a problem, since to drop a table you only need ALTER permission.

    I guess you will have to live with this table. If you absolutely want to get rid of it, you would have to open a support case, so that the support staff can delete the table from the backend.

    Note that if you only have a developer-level support contract, the way you do that is by open a question here in Microsoft Q&A. But you should do this through the portal, so that the question gets labelled as a support issue. As I understand it, the support person who gets assigned to the case will then contact through private message to get the details needed to connect to your server.

    Was this answer helpful?


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  4. Erland Sommarskog 134.3K Reputation points MVP Volunteer Moderator
    2025-02-26T22:25:47.07+00:00

    You need to find some who has sufficient permission. For this operation you need at ALTER permission on the table.

    Was this answer helpful?


  5. Olaf Helper 47,616 Reputation points
    2025-02-26T12:37:03.8433333+00:00

    ALTER TABLE dbo.Eployees

    Typo? Eployees vs Employees

    Was this answer helpful?


Your answer

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