CREATE TABLE ... MASKED WITH
masks values for users without UNMASK
What changes
- Input
- column definition
- Output or change
- dynamic data mask on the column
Syntax at a glance
column_name datatype MASKED WITH ( FUNCTION = 'mask_function' )
Work example
A query result should mask selected values for callers without full access.
Test the mask as a low-privilege principal and check exports, predicates, and privileged bypass paths.
Check your work The restricted principal sees the intended mask and the authorized owner can still validate the source value.
Open Microsoft Learn for full syntax, permissions, and details for your version.