Skip to content

Latest commit

 

History

History
80 lines (65 loc) · 2.42 KB

File metadata and controls

80 lines (65 loc) · 2.42 KB

title: "CLOSE MASTER KEY (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "05/15/2017" ms.prod: "sql" ms.prod_service: "database-engine, sql-database, sql-data-warehouse, pdw" ms.service: "" ms.component: "t-sql|statements" ms.reviewer: "" ms.suite: "sql" ms.technology:

  • "database-engine" ms.tgt_pltfrm: "" ms.topic: "language-reference" f1_keywords:
  • "CLOSE MASTER KEY"
  • "CLOSE_MASTER_KEY_TSQL" dev_langs:
  • "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" ms.assetid: bb04ef7a-9f3a-437e-a6f9-ba0204082cb9 caps.latest.revision: 30 author: "edmacauley" ms.author: "edmaca" manager: "craigg" ms.workload: "Inactive" monikerRange: ">= aps-pdw-2016 || = azuresqldb-current || = azure-sqldw-latest || >= sql-server-2016 || = sqlallproducts-allversions"

CLOSE MASTER KEY (Transact-SQL)

[!INCLUDEtsql-appliesto-ss2008-all-md]

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