Skip to content

Latest commit

 

History

History
74 lines (57 loc) · 2.31 KB

close-master-key-transact-sql.md

File metadata and controls

74 lines (57 loc) · 2.31 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
CLOSE MASTER KEY (Transact-SQL)
CLOSE MASTER KEY (Transact-SQL)
VanMSFT
vanto
05/15/2017
sql
t-sql
reference
CLOSE MASTER KEY
CLOSE_MASTER_KEY_TSQL
encryption [SQL Server], Database Master Key
CLOSE MASTER KEY statement
database master key [SQL Server], closing
cryptography [SQL Server], Database Master Key
closing Database Master Keys
TSQL
>=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current

CLOSE MASTER KEY (Transact-SQL)

[!INCLUDE sql-asdb-asdbmi-asa-pdw]

Closes the master key of the current database.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

CLOSE MASTER KEY  

[!INCLUDEsql-server-tsql-previous-offline-documentation]

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: [!INCLUDEssazuresynapse-md] 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