Select
u.UserID,
smp_userid,
p.username,
p.user_adsid,
p.user_guid,
p.email,
p.first_name_ru,
p.last_name_ru,
p.middle_name_ru,
p.internal_phone,
p.country_code,
p.city,
p.gender,
p.first_name_en,
p.last_name_en
join dbo.users u on u.ExternalDisplayName = p.smp_userid
where
(p.username <> u.Nick or
p.user_adsid <> u.SID or
-- p.user_guid <> u. or--!!!! проверить --- нет, неперсонализированные GUID не равны
(p.email <> u.email and (u.email not like '%.ru1'))or
p.first_name_ru <> u.FirstName or
p.last_name_ru <> u.LastName or
p.middle_name_ru <> u.MiddleName or
p.internal_phone <> u.Phone or
p.country_code <> u.Country or
p.city <> u.City or
(p.last_name_en+' '+p.first_name_en) <> isnull(u.EnglishDisplayName,'') or
p.gender<> u.Gender)
Update
- Возможны ошибке в передачи неймов (ферст ласт)
Nick << p.UserName
SID << p.user_adsid
email << p.email
FirstName << p.first_name_ru
LastName << p.last_name_ru
MiddleName << p.middle_name_ru
Phone << p.internal_phone
Country << p.country_code
City << p.city
Gender << p.gender
EnglishDisplayName << p.last_name_ru + " " + p.first_name_ruWhere ExternalDisplayName = smp_userid