Retrieving Permissions for a login/user in SQL Server

By using the function “fn_my_permissions()” we can fetch the permissions that a login has at server level and at database level. This function returns a list of the permissions effectively granted to the principal on a securable.

Syntax:

fn_my_permissions ( securable , 'securable_class')

Fetching what permissions does a login has at Server level:

SELECT * FROM fn_my_permissions(NULL, 'SERVER');

Fetching what permissions does a user has at Database level:

SELECT * FROM fn_my_permissions(NULL, 'DATABASE');
Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

  • Recent Posts

    • 450,717 hits
  • Join 37 other followers

  • Archives

  • Categories

  • July 2011
    M T W T F S S
    « Jun   Sep »
     123
    45678910
    11121314151617
    18192021222324
    25262728293031
  • Advertisements
%d bloggers like this: