Insert into ModulePermission(ModuleID, PermissionID, AllowAccess, RoleID, UserID, CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate, PortalID)
(Select Modules.ModuleID, 2, 1, 6, NULL, 1, '2023-06-15', 1, '2023-06-15', 0
From Modules
Where Modules.ModuleDefID = 122)
Delete ModulePermission where RoleID = 6