Yesterday I wanted to know which users have what permissions to a database. So I started querying the two tables related to it.
select * from sys.database_permissionsselect * from sys.database_principals
I came up with the following script to suit my needs.
select USER_NAME(perm.grantee_principal_id) AS user_name, princ.principal_id, princ.type_desc AS principal_type_desc,
OBJECT_NAME(perm.major_id) AS object_name,
perm.permission_name, perm.state_desc AS permission_state_desc
from sys.database_permissions perm
inner JOIN sys.database_principals princ
on perm.grantee_principal_id = princ.principal_id
There may be numerous other ways to do this.
Today I had a situation where a few of the subscriptions for a particular report have failed. I needed a script to run only these subscripti...
I have been in hibernation for too long now. I have changed jobs and now hjaving an opportunity to work on SAS code after nearly 11 years. ...
What is Checksum? Checksum is a function available in sql server 2005 and sql server 2008. It is intended to build a hash index based on an ...