SQL Flow Field Guide

OPEN SYMMETRIC KEY

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

opens a symmetric key for ENCRYPTBYKEY/DECRYPTBYKEY

What changes

Input
key protector (certificate, key, password)
Output or change
session key state

Syntax at a glance

OPEN SYMMETRIC KEY Key_name DECRYPTION BY <decryption_mechanism>

Work example

A session needs one symmetric key for an approved encryption operation.

Trace the key protector and caller, then open it only around the required work in a lab.

Check your work The intended value operation succeeds and unrelated session work cannot use the open key.

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