0 pts.
 Listing Documents In A View based on the Current User Role
Hi All ! I need to list the documents in the view for the Current User role.(For Example, I have the user role as 'Developer' enabled, so I need to list all the documents that have been created using this 'Developer' user role). Waiting for a prompt and positive reply. Regards Ravi.

Software/Hardware used:
ASKED: April 19, 2005  1:25 AM
UPDATED: April 20, 2005  5:30 AM

Answer Wiki:
Hi there, I'm not sure what context you want to run this in but the following code will fetch a list of views created by the specified user role when run in the query analyser: IF IS_MEMBER ('dbo') = 1 (SELECT dbo.sysobjects.name, dbo.sysusers.name AS UserRole FROM dbo.sysobjects INNER JOIN dbo.sysusers ON dbo.sysobjects.uid = dbo.sysusers.uid WHERE (dbo.sysobjects.xtype = 'V') AND (dbo.sysusers.name = 'dbo')) ELSE IF IS_MEMBER ('dbo') IS NULL print 'ERROR: Invalid group / role specified' If you have a limited number of roles that you need to check you could add similar sections underneath - just substitute dbo with the role name (e.g. developer). Hope this is a start...
Last Wiki Answer Submitted:  April 20, 2005  5:30 am  by  Littlew   0 pts.
All Answer Wiki Contributors:  Littlew   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _