我正在研究在 SQL Datawarehouse 的几个数据库中屏蔽个人数据。我创建了一个表,其中包含我想要屏蔽的列,并希望通过这样的单个脚本更改数据库中多个表中存在的这些列
IF EXISTS(SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'TableName' and
COLUMN_NAME = 'BirthDate' OR COLUMN_NAME = 'EmailAddress' OR COLUMN_NAME = 'FirstName' OR COLUMN_NAME = 'LastName' OR COLUMN_NAME = 'MiddleName' OR COLUMN_NAME = 'Name.First' OR COLUMN_NAME = 'MName.Last' OR COLUMN_NAME = 'PhoneNumber'
)
BEGIN
ALTER TABLE TABLE_NAME
ALTER COLUMN [COLUMN_NAME] NVARCHAR(200) MASKED WITH (FUNCTION = 'default()') NULL
END
这不起作用。有任何想法吗?