Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with view syntax
Message
From
03/10/2009 09:35:16
 
 
To
03/10/2009 09:22:29
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2005
Application:
Desktop
Miscellaneous
Thread ID:
01427486
Message ID:
01427498
Views:
52
>>Correction
>>
>>select u_id,
>>	u_name,
>>	ur_RoleId,
>>	r_name, 
>>	Isnull(MIN(ri_Restriction), 0) as restriction
>>	from @User 
>>		join @UserRoles on ( u_id = ur_UserId ) 
>>		join @Role on ( ur_RoleId = r_Id )  /* this is just to see the drscription of the role */
>>		left join @RoleItems  on  (ur_RoleId = ri_RoleId )
>>		group by u_id, u_name, ur_RoleId, r_name
>>
>>
>>1	Viv	1	Admin	0
>>1	Viv	2	User	2
>>
>>
>>
>>But I don't see where ri_ItemId fits in
>
>
>If I do this
>
>select u_id,
>	u_name,
>	ur_RoleId,
>	r_name, 
>	ri_ItemId,
>	Isnull(MIN(ri_Restriction), 0) as restriction
>	from @User 
>		join @UserRoles on ( u_id = ur_UserId ) 
>		join @Role on ( ur_RoleId = r_Id )  /* this is just to see the drscription of the role */
>		left join @RoleItems  on  (ur_RoleId = ri_RoleId )
>		group by u_id, u_name, ur_RoleId, r_name, ri_ItemId
>
>I get this
>
>u_id	u_name	roleId 	r_name	ItemId	restriction
>1	Viv	1	Admin	NULL	0
>1	Viv	2	User	1	2
>
>
>Would this be a query with as parameters: (UserId, Role, Item_id) to get the restriction back ?

Just passing UserId and ItemId. Get back only the lowest restriction found for the Roles assigned to the user (no RoleItems entry for the Item in question implies no restriction)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform