SQL Flow Field Guide

OPEN MASTER KEY

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

opens the database master key

What changes

Input
password
Output or change
session key state

Syntax at a glance

OPEN MASTER KEY DECRYPTION BY PASSWORD = '<strong password>'

Work example

A session needs the database master key for one protected operation.

Check the caller context and automatic-open configuration, then limit the open interval in a lab.

Check your work The key opens only for the intended operation and is closed when that work ends.

Open Microsoft Learn for full syntax, permissions, and details for your version.