I'm a user of a SQL Sever database, and I want to know my access rights / permissions in the database I'm using. What SQL query should I use to do so?
Thanks
Using SQL Server management studio:In the object explorer window, right click on the view and click on Properties. Navigate to the Permissions tab. Here you can see the list of users or roles who has access to the view. Also, you can see the type of access the user or role has.
First, move to “Object Explorer” and expand the database that you want. Next, under the database, expand the “Security” directory. Now, under Security, expand the “Users” option. This will display a list that contains all the users created in that database.
Server level permissions are stored in internal tables exposed through the sys. server_premissions catalog view. Database level permissions are stored in internal tables exposed through the sys. database_permissions catalog view.
I think the easiest way would be:
SELECT * FROM fn_my_permissions(NULL, 'SERVER');
GO
I tried it in SQL Server 2008.
Ref: https://docs.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-my-permissions-transact-sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With