SQL Flow Field Guide

DECRYPTBYPASSPHRASE

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

cryptographic transform or key lookup

What changes

Input
plaintext or ciphertext and a key, certificate or passphrase
Output or change
ciphertext, plaintext, hash, signature check, or key metadata
Return type
varbinary, with a maximum size of 8,000 bytes.

Syntax at a glance

DecryptByPassPhrase ( { 'passphrase' | @passphrase } , { 'ciphertext' | @ciphertext } [ , { add_authenticator | @add_authenticator } , { authenticator | @authenticator } ] )

Work example

Maintain decryption of existing passphrase-encrypted bytes.

Use synthetic data in an isolated database. Follow the existing key hierarchy and keep keys and plaintext out of output.

Check your work Keep the passphrase in an approved secret store and plan a reviewed migration if the scheme fails policy.

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