Rediger

DROP MASTER KEY (Transact-SQL)

Applies to: SQL Server Azure SQL Managed Instance Azure Synapse Analytics SQL database in Microsoft Fabric

Removes the master key from the current database.

Transact-SQL syntax conventions

Syntax

DROP MASTER KEY  

Arguments

This statement takes no arguments.

Remarks

The drop will fail if any private key in the database is protected by the master key.

Permissions

Requires CONTROL permission on the database.

Examples

The following example removes the master key for the AdventureWorks2025 database.

Note

In Azure SQL Database and SQL database in Microsoft Fabric, the USE statement isn't available. Instead, connect directly to intended database and run the rest of the code sample.

USE AdventureWorks2022;  
DROP MASTER KEY;  
GO  

Examples: Azure Synapse Analytics

The following example removes the master key.

Note

In Azure SQL Database and SQL database in Microsoft Fabric, the USE statement isn't available. Instead, connect directly to the master database and run the rest of the code sample.

USE master;  
DROP MASTER KEY;  
GO