chandu1551
4/12/2018 - 2:03 PM

Remove all Users from Second Level Nodes Using NodeId

Remove all Users from Second Level Nodes Using NodeId

SELECT *
	,rm.Code
FROM UserRoleXNode urn
INNER JOIN UserXRole ur ON urn.UserRoleId = ur.Id
INNER JOIN RoleMaster rm ON ur.RoleId = rm.Id
	AND rm.Code <> 'ADMIN'
WHERE urn.NodeId in (15,17,16,14,7)
	AND urn.IsActive = 1

UPDATE urn
SET urn.IsActive = 0
FROM UserRoleXNode urn
INNER JOIN UserXRole ur ON urn.UserRoleId = ur.Id
INNER JOIN RoleMaster rm ON ur.RoleId = rm.Id
	AND rm.Code <> 'ADMIN'
WHERE urn.NodeId in (15,17,16,14,7)
	AND urn.IsActive = 1