select * from tbl_IMPORT_Contacts i with (nolock) select i.ownerId,i.ownerType,i.eai_batchId,i.fseFSPRO_UserId,i.email,i.first_name,i.last_name,i.country,i.honorific,i.street_address,i.city,i.state,i.zipcode,i.group_names,i.company from tbl_IMPORT_Contacts i with (nolock) where i.ownerId = and i.ownerType = and i.eai_batchId = and i.fseFSPRO_UserId is null and not exists ( select o1.ownerId,o1.ownerType,o1.eai_batchId,o1.fseFSPRO_UserId,o1.email,o1.first_name,o1.last_name,o1.company from tbl_IMPORT_Contacts o1 where o1.ownerId = i.ownerId and o1.ownerType = i.ownerType and o1.eai_batchId =i.eai_batchId and o1.email =i.email and (o1.first_name <>i.first_name or o1.last_name <>i.last_name or o1.company <>i.company) ) order by i.eai_lineNumber select i.first_name,i.last_name,i.company,i.email,i.ownerId,i.ownerType,i.eai_batchId,i.company from tbl_IMPORT_Contacts i with (nolock) where i.ownerId = and i.ownerType = and i.eai_batchId = and i.fseFSPRO_UserId is null and exists ( select o1.first_name,o1.last_name,o1.email,o1.ownerId,o1.ownerType,o1.eai_batchId,o1.company from tbl_IMPORT_Contacts o1 where o1.ownerId = i.ownerId and o1.ownerType = i.ownerType and o1.eai_batchId =i.eai_batchId and o1.email =i.email and (o1.first_name <>i.first_name or o1.last_name <>i.last_name or o1.company <>i.company) ) order by i.eai_lineNumber select salutation,firstname,lastname,email,address1,city,state,countryID,ZipCode,FSPro_UserId from tbl_FSPRO_members with (nolock) where email = and ownerId = and FSL_TableCode = and OrgType is null select countryid from tbl_UT_Countries with (nolock) where Country LIKE 'U_S.A%' Country LIKE INSERT INTO tbl_FSPRO_members (ownerId, FSL_TableCode, salutation,firstname,lastname,organization,email,address1,city,state,countryID,ZipCode,createDate,OriginalSource) VALUES ( , , , , , , , , , , , , , ) update tbl_FSPRO_members set salutation = , firstname = , lastname = , organization = , address1 = , city = , state = , countryID = , ZipCode = , LastUpdated = , OriginalSource = where email = and ownerId = and FSL_TableCode = and OrgType is null update tbl_IMPORT_Contacts set fseFSPro_UserId = , fseFSPro_UserId_Status = where email = and ownerId = and ownerType = and eai_batchId = INSERT INTO tbl_SEC_Groups (OwnerID,FSL_TableCode,GroupName,GroupDescription,GroupTypeCD,createdDate) VALUES( , , , '','UD', ) INSERT INTO tbl_SEC_MemGrpLink (FSPro_UserID,GroupID) VALUES(,) SELECT MemGrpLinkID from tbl_SEC_MemGrpLink where FSPro_UserID = and GroupID = INSERT INTO tbl_SEC_MemGrpLink (FSPro_UserID,GroupID) VALUES(,) select i.first_name, i.last_name,i.email,i.company, i.group_names,i.fseFSPro_UserId, i.fseFSPro_UserId_Status from tbl_IMPORT_Contacts i with (nolock) where i.ownerId = and i.ownerId = and i.eai_batchId = order by i.eai_lineNumber select i.firstname, i.lastname,j.company,i.email, i.FSPro_UserId, j.fseFSPro_UserId_Status from tbl_FSPRO_members i with (nolock) inner join tbl_IMPORT_Contacts j with (nolock) on i.ownerId = j.ownerId and i.FSL_TableCode = j.ownerType and i.email = j.email where j.ownerId = and j.ownerType = and j.eai_batchId = and i.OrgType is null select i.GroupID, i.GroupName,i.ownerId,i.FSL_TableCode from tbl_SEC_Groups i where i.GroupName in() and i.ownerId = and i.FSL_TableCode = select first_name,last_name,country,honorific,street_address,city,state,zipcode,group_names,company from qmd_importValid where country IN ()