SQL Flow Field Guide

PWDENCRYPT

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

security context lookup

What changes

Input
security context (login, user, roles, permissions)
Output or change
name, id or boolean
Return type
varbinary(128)

Syntax at a glance

PWDENCRYPT ( 'password' )

Work example

Recognize the legacy SQL Server password-hash function in old code.

Test under the intended execution context. Use GRANT and DENY rather than returned identity text.

Check your work Do not create new password hashes with it and plan migration to approved Argon2id authentication.

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