PWDCOMPARE
security context lookup
What changes
- Input
- security context (login, user, roles, permissions)
- Output or change
- name, id or boolean
- Return type
- int Returns 1 if the hash of the clear_text_password matches the password_hash parameter, and 0 if it does not.
Syntax at a glance
PWDCOMPARE ( 'clear_text_password' , password_hash [ , version ] )
Work example
Maintain verification of an existing SQL Server-specific password hash.
Test under the intended execution context. Use GRANT and DENY rather than returned identity text.
Check your work Do not build new password storage with it and move authentication to an approved Argon2id design.
Open Microsoft Learn for full syntax, permissions, and details for your version.