SQL Server › Dynamic Data Masking
What built-in masking functions are available in SQL Server for dynamic data masking?
BeginnerAnswer
SQL Server provides several built-in masking functions including default, which fully hides a value based on its data type, email, which partially masks an email address, random, which replaces a numeric value with a random number within a specified range, and partial, which lets you define a custom pattern showing only certain characters.
ALTER TABLE Customers
ALTER COLUMN Phone ADD MASKED WITH (FUNCTION = 'partial(0,"XXX-XXX-",4)');Real-world example A company masks customer phone numbers so that support staff without special permission only see the last four digits, following a partial masking pattern that hides most of the number while still allowing basic identification.