CLOSE MASTER KEY (Transact-SQL)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2008) ![yes](media/yes.png)Azure SQL Database ![yes](media/yes.png)Azure SQL Data Warehouse ![yes](media/yes.png)Parallel Data Warehouse

Closes the master key of the current database.

Topic link icon Transact-SQL Syntax Conventions

Syntax

CLOSE MASTER KEY  

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 AdventureWorks2012;  
CLOSE MASTER KEY;  
GO  

Examples: [!INCLUDEssSDWfull] and [!INCLUDEssPDW]

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