Files
sql-server-samples/samples/features/security/code-snacks/sqlonlinux/advanced-security/SQL Resources/Configure Masking.sql
T
2016-11-16 07:07:57 -05:00

11 lines
445 B
Transact-SQL

USE [AdventureWorks]
GO
-- Mask the NationalIDNumber column so it only displays the last two digits of field (for example: XX-XXX-XX43)
ALTER TABLE HumanResources.Employee
ALTER COLUMN NationalIDNumber ADD MASKED WITH(FUNCTION = 'partial(0,"XX-XXX-XX",2)')
-- Mask the rate by providing a random value in place of the actual rate
ALTER TABLE HumanResources.EmployeePayHistory
ALTER COLUMN Rate ADD MASKED WITH (FUNCTION = 'random(20,150)')