SQL SERVER – What Permissions I have on Database I am Connected to?

SQL SERVER - What Permissions I have on Database I am Connected to? permissionimage Here is the first thing I do when I get access to any new server – I check what are different permissions I have with respect to the database I am connected with. The matter of the fact is that most of the database consultants and administrator want to know what are different permissions they have on the database when they get access to any new system. I personally want to own only the permissions which help me to accomplish my work, not a single permission more or less. If I have more permissions, I request the team to take away so I do not make any mistakes accidently.

Here is the script which you can execute to get a list of the permissions over databases.

SELECT * FROM fn_my_permissions (NULL, 'DATABASE');
GO


Here is the result set of above query when I executed with sa or admin access.

Here is the result set of above query when I executed with public access.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Scripts, SQL Server Security
Previous Post
Developer – Nine Things Developers Hate to Hear
Next Post
SQL SERVER – Learning More About SQL Wait Stats

Related Posts

3 Comments. Leave new

  • Hello Pinal,

    I tried above code with sa login but i got nothing.
    Please see below result.

    entity_name subentity_name permission_name
    ——————————————————————————————————————————– ——————————————————————————————————————————– ————————————————————

    (0 row(s) affected)

    BR,
    Neha

    Reply
  • Thanks Pinal. I have learnt something new today!

    Reply
  • Thank you Eng PINAL DAVE, very easy, very helpful.

    Reply

Leave a Reply

Menu
Exit mobile version