update tbl_OPR_ClientOperators set primaryContactId = where operatorId = and ownerId = and fslTableCode = update tbl_OPR_ClientOperators set primaryContactId = where operatorId = and ownerId = and fslTableCode = 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 = update tbl_CDR_ContactDetails set salesRep = , salesManager = , mfrBuyer = , districtId = , managerId = where fspro_userid = and ownerId = and ownerType = insert into tbl_CDR_ContactDetails ( ownerId, ownerType, fspro_userid, salesRep, salesManager, mfrBuyer, districtId, managerId ) values ( , , , ,, , , ) with fields as ( select f.fieldId, rtrim( ltrim( f.name )) name, rtrim( ltrim( f.category )) category, rtrim( ltrim( f.label )) label, f.type, f.required, f.format, f.config, f.sortRank, f.maxLength from tbl_#_flexDomain#_Fields f with (nolock) where ownerId = and ownerType = ) select * from fields where category in ( ) update tbl_#_flexDomain#_FieldValues set data = where partnerId = and partnerType = and fieldId = and valueIndex = 1 insert into tbl_#_flexDomain#_FieldValues ( fieldId, partnerId, partnerType, data, valueIndex ) values ( , , , , 1 ) delete from tbl_#_flexDomain#_FieldValues where partnerId = and partnerType = and fieldId =