Monday, May 20, 2024

SQL SERVER CANNOT LOGIN

  SELECT sp.[name],sp.type_desc

FROM sys.server_principals sp

INNER JOIN sys.server_permissions PERM ON sp.principal_id = PERM.grantee_principal_id

WHERE PERM.state_desc = 'DENY'

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';