A trigger for grant sysadmin

  • Can someone give me a script that fires a trigger whenever sysadmin access is granted to a perticular login and rollback?

    many thanks

  • In order to audit for members of the sysadmin fixed server role, we will need to use two system views: sys.server_role_members and sys.server_principals.

    SELECT sp.principal_id

    FROM sys.server_role_members srm

    INNER JOIN sys.server_principals sp

    ON srm.member_principal_id = sp.principal_id

    WHERE srm.role_principal_id = (

    SELECT principal_id

    FROM sys.server_principals

    WHERE [Name] = 'sysadmin')

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply