Act! promote secondary contacts

UPDATE SC SET SC.COMPANYID = PC.COMPANYID FROM TBL_CONTACT SC LEFT JOIN TBL_SECONDARY On SC.CONTACTID = TBL_SECONDARY.SECONDARYID LEFT JOIN TBL_CONTACT PC On PC.CONTACTID = TBL_SECONDARY.CONTACTID LEFT JOIN TBL_COMPANY COMPANY On COMPANY.COMPANYID = PC.COMPANYID WHERE SC.TYPENUM = 2 AND SC.COMPANYID IS NULL; UPDATE SC SET SC.COMPANYNAME = PC.COMPANYNAME FROM TBL_CONTACT SC LEFT JOIN TBL_SECONDARY On SC.CONTACTID = TBL_SECONDARY.SECONDARYID LEFT JOIN TBL_CONTACT PC On PC.CONTACTID = TBL_SECONDARY.CONTACTID LEFT JOIN TBL_COMPANY COMPANY On COMPANY.COMPANYID = PC.COMPANYID WHERE SC.TYPENUM = 2 AND (SC.COMPANYNAME IS NULL OR SC.COMPANYNAME = '' OR SC.COMPANYNAME = ' '); UPDATE SC SET SC.TYPENUM = 0 FROM TBL_CONTACT SC LEFT JOIN TBL_SECONDARY On SC.CONTACTID = TBL_SECONDARY.SECONDARYID LEFT JOIN TBL_CONTACT PC On PC.CONTACTID = TBL_SECONDARY.CONTACTID LEFT JOIN TBL_COMPANY COMPANY On COMPANY.COMPANYID = PC.COMPANYID WHERE SC.TYPENUM = 2; DELETE TBL_SECONDARY FROM TBL_SECONDARY LEFT JOIN TBL_CONTACT ON TBL_SECONDARY.SECONDARYID = TBL_CONTACT.CONTACTID WHERE TBL_CONTACT.TYPENUM = 2;
Promote Act! secondary contacts to become primary contacts.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.