August 19, 2008 at 1:56 pm
I am looking for a script to run to list users and their permissions on tables. I see I can go under Users|Select a User|All Tasks|Manage Permissions but there is no way to export this out to show someone else. I would like to run a script to do this exact process so I can copy it to an email.
Thanks
Scott
August 19, 2008 at 2:43 pm
This lists permissions in every database in an instance.
--Lists a user's object permissions in every database. Specify the user name.
sp_MSforeachdb 'use ? Print DB_Name() select cast(o.name as varchar(45))as ''object''
,case p.action
when 193 then ''SELECT''
when 195 then ''INSERT''
when 196 then ''DELETE''
when 197 then ''UPDATE''
when 224 then ''EXECUTE''
else '' ''
end as ''permission''
from sysprotects p join sysobjects o
on o.id = p.id
where p.uid = (select u.uid from sysusers u
where name = ''XXXX_Application'')'
Greg
August 20, 2008 at 12:58 pm
Thanks Greg.. The script works great..
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply