Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Roles and User Permissions Script for SQLSERVER 2000 Expand / Collapse
Author
Message
Posted Monday, June 4, 2012 8:25 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 25, 2013 11:59 AM
Points: 4, Visits: 52
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 ........!
Post #1310518
Posted Monday, June 4, 2012 9:05 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, October 22, 2014 9:12 AM
Points: 114, Visits: 997
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

Post #1310555
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse