select cdr_dstname, primaryContactId from tbl_DW_CrmDistributors#_tableSuffix# where cdr_recordId = update tbl_CDR_Distributors set primaryContactId = where cdr_recordId = and ownerId = and fsl_tablecode = update tbl_CDR_Distributors set primaryContactId = where cdr_recordId = and ownerId = and fsl_tablecode = insert into tbl_CDR_ContactDetails ( ownerId, ownerType, fspro_userid ) values ( , , ) insert into tbl_CRM_PartnerURLs (ownerId, ownerType, partnerId, partnerType, urlType, urlValue) values ( , , , 'OPR', , ) SET NOCOUNT ON INSERT INTO tbl_CDR_Distributors(OwnerID, FSL_TableCode, cdr_dstname, cdr_dstaddress1, cdr_dstaddress2, cdr_dstcity, cdr_dststate, cdr_dstzip, cdr_dstCode, cdr_dstcompanytype, cdr_territoryid, cdr_dstcountryID, classificationId, fsl_dstId, fslBuyingGroupId) VALUES (, , , , , , , , , , , , , , ) SELECT NewDistributorID = @@identity SET NOCOUNT OFF