从角色中删除用户

时间:2014-10-03 12:29:31

标签: sql .net asp.net-membership

我有大量用户需要从我的.net成员资格数据库中的某些角色中删除。

我不想使用前端做这个,这需要一个年龄,我想知道在数据库中直接从SQL中的aspnet_UsersInRoles表中删除记录是否安全?

DELETE FROM [webMembership].[dbo].[aspnet_UsersInRoles]
 WHERE [UserId] IN (SELECT [UserId]
                      FROM [webMembership].[dbo].[aspnet_UsersInRoles]
                     WHERE [RoleId] IN (SELECT [RoleId]
                                          FROM [webMembership].[dbo].[aspnet_Roles]
                                         WHERE [RoleName] LIKE 'WAR%')
                       AND [UserId] IN (SELECT [UserId]
                                          FROM [webMembership].[dbo].[CustomProfile]
                                         WHERE [CustomerCountry] = 'NO'))

0 个答案:

没有答案