Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 DB wise permissions

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2011-11-15 : 04:30:39
Hi Team,
I need to get all the permissions on a database. total how many users, what type of permissions having on the database. like wise.

i have around 10 databases. so could you please provide me the script to get the logins and permissions on the database.

thanks in advance


Arnav
Even you learn 1%, Learn it with 100% confidence.

vikki.seth
Yak Posting Veteran

66 Posts

Posted - 2011-11-19 : 08:11:21
Below queries returns a list of the permissions effectively granted to the principal on a securable. You can impersonate a user by using Execute as 'Usename' or setuser 'username'


•To list your effective permissions on the server:
SELECT * FROM fn_my_permissions(NULL, 'SERVER');
•To list your effective permissions on the database:
SELECT * FROM fn_my_permissions(NULL, 'DATABASE');
•To list your effective permissions on object level
SELECT * FROM fn_my_permissions('ObjectNAme', 'OBJECT'));
Go to Top of Page
   

- Advertisement -