Skip to content

Instantly share code, notes, and snippets.

@gotdibbs
Last active December 19, 2015 00:39
Show Gist options
  • Save gotdibbs/5870067 to your computer and use it in GitHub Desktop.
Save gotdibbs/5870067 to your computer and use it in GitHub Desktop.
Check users against MSCRM_CONFIG database for invalid user id error #sql #crm
use [ORGANIZATIONNAME_MSCRM];
select crm.FullName
from SystemUser crm
where crm.IsDisabled = 0
and not exists
(
select crm.SystemUserId
from MSCRM_CONFIG.dbo.SystemUserOrganizations config
join MSCRM_CONFIG.dbo.Organization org
on org.Id = config.OrganizationId
where crm.SystemUserId = config.CrmUserId
)
order by crm.FullName asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment