Wednesday, May 8, 2024

SQL SERVER list Masked columns details

 select  princ.name

,       princ.type_desc

,       perm.permission_name

,       perm.class_desc

,       object_name(perm.major_id)

,       m.name as "COLUMN NAME"

,       schem.name as "SCHEMA"

from    sys.database_principals princ

left join

        sys.database_permissions perm

on      perm.grantee_principal_id = princ.principal_id

left join sys.masked_columns m

on   perm.major_id=m.object_id

left join sys.schemas schem

on perm.major_id=schem.schema_id

where perm.permission_name='UNMASK';

No comments:

Post a Comment