How do you check and see whether you have permission on a specific object and what permission types you have been granted? This requirement comes whenever you experience a permission issue and it might not be easy to get relevant information from relevant department or person. However, SQL Server offers a function for us: fn_my_permissions. This function can be used for seeing all permissions you have been granted on a particular object;
- <div style="text-align: justify;">
- SELECT * FROM fn_my_permissions (NULL, 'DATABASE'); </div>
- USE AdventureWorks2014;
- GO
- <div style="text-align: justify;">
- SELECT * FROM fn_my_permissions('Sales.SalesOrderHeader', 'OBJECT') ;</div>
This function accepts securable and securable class. There are multiple classes such as DATABASE, SCHEMA, OBJECT etc.
For more info: https://msdn.microsoft.com/en-us/library/ms176097.aspx
No comments:
Post a Comment