Pages

Tuesday, November 3, 2009

Grant Permissions

To give permissions to SE's to excute but not modify stuff as dbo
GRANT execute on SCHEMA::dbo to [SE]

TO give permissions to SE's to trace
grant alter trace to [SE]

TO give permissions to SE's to a particular object
GRANT alter on table [tablename] to [SE]


Get/View Permissions for users in DB

select loginname,* from master.dbo.syslogins
where name in ('user1','user2')

select dp.NAME AS principal_name,
dp.type_desc AS principal_type_desc,
o.NAME AS object_name,
p.permission_name,
p.state_desc AS permission_state_desc
from sys.database_permissions p
left OUTER JOIN sys.all_objects o
on p.major_id = o.OBJECT_ID
inner JOIN sys.database_principals dp
on p.grantee_principal_id = dp.principal_id
where dp.NAME in ('user1','user2')
order by dp.NAME

No comments:

Post a Comment