Sherzy
9/12/2018 - 3:37 AM

String split and not contains

select teachers and username, looking for mismatch of email and username

SELECT  [TeacherId]
      ,[FirstName]
      ,[LastName]
	  	, U.UserName
      ,[Salutation]
      ,[Email]
      ,[ProviderUserKey]
      ,[IsActive]
      ,[ImportId]
      ,[DisplayName]
      ,[DefaultLocation]
  FROM [Teacher] T
JOIN  [aspnet_Users] U on U.UserId = T.ProviderUserKey
where IsActive = 1
and  u.UserName not like '%'+Substring(Email, 1,Charindex('@', Email)-1)+'%'
Order by LastName