June 4, 2012 at 8:25 am
hi anyone please post query for all sql permissions and role permissions of all users in a database for SQLSERVER 2000.
I did lot of research in the internet but i didn't find any script to resolve my issue...!
i badly required it asap.
Please ........!
June 4, 2012 at 9:05 am
In following query if a.Islogin=0 then consider a.name as database Role else database user
select a.name UserName,a.Islogin, c.name ObjectName,
case b.actadd
when 1 then 'SELECT'
when 2 then 'UPDATE'
when 3 then 'SELECT,UPDATE'
when 4 then 'REFERENCES'
when 5 then 'SELECT, REFERENCES'
when 6 then 'UPDATE,REFERENCES'
when 7 then 'SELECT,UPDATE,REFERENCES'
when 8 then 'INSERT'
when 9 then 'SELECT,INSERT'
when 10 then 'UPDATE,INSERT'
when 11 then 'SELECT,UPDATE,INSERT'
when 12 then 'REFERENCES,INSERT'
when 13 then 'SELECT,REFERENCES,INSERT'
when 14 then 'UPDATE,REFERENCES,INSERT'
when 15 then 'SELECT,UPDATE,REFERENCES,INSERT'
when 16 then 'DELETE'
when 17 then 'SELECT,DELETE'
when 18 then 'UPDATE,DELETE'
when 19 then 'SELECT,UPDATE,DELETE'
when 20 then 'REFERENCES,DELETE'
when 21 then 'SELECT,REFERENCES,DELETE'
when 22 then 'UPDATE,REFERENCES,DELETE'
when 23 then 'SELECT,UPDATE,REFERENCES,DELETE'
when 24 then 'INSERT,DELETE'
when 25 then 'SELECT,INSERT,DELETE'
when 26 then 'UPDATE,INSERT,DELETE'
when 27 then 'SELECT,UPDATE,INSERT,DELETE'
when 28 then 'REFERENCES,INSERT,DELETE'
when 29 then 'SELECT,REFERENCES,INSERT,DELETE'
when 30 then 'REFERENCES,INSERT,DELETE'
when 31 then 'SELECT,UPDATE,REFERENCES,INSERT,DELETE'
when 32 then 'EXECUTE' else NULL end GRANTED,
case b.actmod
when 1 then 'SELECT'
when 2 then 'UPDATE'
when 3 then 'SELECT,UPDATE'
when 4 then 'REFERENCES'
when 5 then 'SELECT, REFERENCES'
when 6 then 'UPDATE,REFERENCES'
when 7 then 'SELECT,UPDATE,REFERENCES'
when 8 then 'INSERT'
when 9 then 'SELECT,INSERT'
when 10 then 'UPDATE,INSERT'
when 11 then 'SELECT,UPDATE,INSERT'
when 12 then 'REFERENCES,INSERT'
when 13 then 'SELECT,REFERENCES,INSERT'
when 14 then 'UPDATE,REFERENCES,INSERT'
when 15 then 'SELECT,UPDATE,REFERENCES,INSERT'
when 16 then 'DELETE'
when 17 then 'SELECT,DELETE'
when 18 then 'UPDATE,DELETE'
when 19 then 'SELECT,UPDATE,DELETE'
when 20 then 'REFERENCES,DELETE'
when 21 then 'SELECT,REFERENCES,DELETE'
when 22 then 'UPDATE,REFERENCES,DELETE'
when 23 then 'SELECT,UPDATE,REFERENCES,DELETE'
when 24 then 'INSERT,DELETE'
when 25 then 'SELECT,INSERT,DELETE'
when 26 then 'UPDATE,INSERT,DELETE'
when 27 then 'SELECT,UPDATE,INSERT,DELETE'
when 28 then 'REFERENCES,INSERT,DELETE'
when 29 then 'SELECT,REFERENCES,INSERT,DELETE'
when 30 then 'REFERENCES,INSERT,DELETE'
when 31 then 'SELECT,UPDATE,REFERENCES,INSERT,DELETE'
when 32 then 'EXECUTE' else NULL end DENIED
from dbo.sysusers a,
dbo.syspermissions b,
dbo.sysobjects c
where a.uid = b.grantee and b.[id] = c.[id] and b.grantee <> 0
order by a.name
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply