Skip to content

Latest commit

 

History

History
74 lines (57 loc) · 2.31 KB

File metadata and controls

74 lines (57 loc) · 2.31 KB
title CLOSE MASTER KEY (Transact-SQL)
description CLOSE MASTER KEY (Transact-SQL)
author VanMSFT
ms.author vanto
ms.date 05/15/2017
ms.service sql
ms.subservice t-sql
ms.topic reference
f1_keywords
CLOSE MASTER KEY
CLOSE_MASTER_KEY_TSQL
helpviewer_keywords
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
dev_langs
TSQL
monikerRange >=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.

Topic link icon 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 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