![alt text][1]I have two table #temp1 user and profile mapping and second #temp2 Profile and permission mapping.
permissions in Some profiles are subset of other profile permission,
I want to exclude those profiles from user profile mapping.
in this case conside profile P1 has read and write permission and P2 has read,write,delete and alter pemission
so basically its subset of P1, So if user S is attached with both P1 and P2,
result set should only dispaly S and P2 mapping.
Given below sample table strucutre. As per above logic output should be
S P2
T P1
T P3
U p4
create table #temp1(username varchar (50) ,Profilename VARCHAR(500))
create table #temp2(Profilename VARCHAR(500),permaname varchar(250)
GO
INSERT INTO #temp1 VALUES('s','P1')
INSERT INTO #temp1 VALUES('s','P2')
INSERT INTO #temp1 VALUES('s','P3')
INSERT INTO #temp1 VALUES('T','P1')
INSERT INTO #temp1 VALUES('T','P3')
INSERT INTO #temp1 VALUES('U','P1')
INSERT INTO #temp1 VALUES('U','P4')
INSERT INTO #temp2 VALUES('P1','Read')
INSERT INTO #temp2 VALUES('P1','Write')
INSERT INTO #temp2 VALUES('P2','Read')
INSERT INTO #temp2 VALUES('P2','Write')
INSERT INTO #temp2 VALUES('P2','DELETE')
INSERT INTO #temp2 VALUES('P2','ALTER')
INSERT INTO #temp2 VALUES('P3','Read')
INSERT INTO #temp2 VALUES('P3','DELETE')
INSERT INTO #temp2 VALUES('P4','Read')
INSERT INTO #temp2 VALUES('P4','WRITE')
INSERT INTO #temp2 VALUES('P4','DELTE')
INSERT INTO #temp2 VALUES('P4','ALTER')
INSERT INTO #temp2 VALUES('P4','DROP')
[1]: /storage/temp/883-table+records.gif
↧