February 7, 2012

Adding roles of a certain user to your Id

One of the easy ways of giving yourself all the roles/accesses of a particular user; no doubts you need to have "insert" privileges on the database where this is desired :

INSERT INTO PSROLEUSER
(SELECT 'YOUR_USER_ID', B.ROLENAME, 'N'
FROM PSROLEUSER B
WHERE B.ROLEUSER = 'USER_WHOSE_ACCESSES_ARE_REQUIRED'
AND NOT EXISTS
(SELECT 'Y'
FROM PSROLEUSER C
WHERE C.ROLEUSER = 'YOUR_USER_ID' AND C.ROLENAME = B.ROLENAME));

This sql will add all the roles of the user whose accesses are required to your id.

No comments:

Post a Comment