Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

CLOSE MASTER KEY (Transact-SQL)

Applies to: 👁 Image
SQL Server 👁 Image
Azure SQL Database 👁 Image
Azure SQL Managed Instance 👁 Image
Azure Synapse Analytics 👁 Image
Analytics Platform System (PDW) 👁 Image
SQL database in Microsoft Fabric

Closes the master key of the current database.

👁 Image
Transact-SQL syntax conventions

Syntax

CLOSE MASTER KEY 

Note

This syntax is not supported by serverless SQL pool in Azure Synapse Analytics.

Arguments

Takes no arguments.

Remarks

This statement reverses the operation performed by OPEN MASTER KEY. CLOSE MASTER KEY only succeeds when the database master key was opened in the current session by using the OPEN MASTER KEY statement.

Permissions

No permissions are required.

Examples

USE AdventureWorks2022; 
CLOSE MASTER KEY; 
GO 

Examples: Azure Synapse Analytics and Analytics Platform System (PDW)

USE master; 
OPEN MASTER KEY DECRYPTION BY PASSWORD = '43987hkhj4325tsku7'; 
GO 
CLOSE MASTER KEY; 
GO 

See Also

CREATE MASTER KEY (Transact-SQL)
OPEN MASTER KEY (Transact-SQL)
Encryption Hierarchy


Feedback

Was this page helpful?

Additional resources