update tbl_#_domain#_Fields set required = , maxLength = , label = , searchable = , config = , active = , sortRank = , format = , lookupValueSortMode = where fieldId = and ownerId = and ownerType = select max( sortRank ) maxSortRank from tbl_#_domain#_Fields where ownerId = and ownerType = and category = insert into tbl_#_domain#_Fields ( ownerId, ownerType, category, name, type, required, maxLength, label, searchable, config, active, sortRank, format, lookupValueSortMode ) values ( , , , , , , , , , , , , , ) update tbl_#_domain#_Fields set name = where fieldId = and ownerId = and ownerType = select contactFieldMapping from tbl_WRK_Forms where formId = and ownerId = and ownerType = update tbl_WRK_Forms set contactFieldMapping = where formId = and ownerId = and ownerType = and coalesce( contactFieldMapping, '' ) = delete tbl_WRK_Conditions where ownerId = and ownerType = and targetType = 'F' and targetKey = insert into tbl_WRK_Conditions ( ownerId, ownerType, targetType, targetKey, sourceFieldId, sourceFieldOp, sourceFieldValue ) values ( , , 'F', , , , ) delete from tbl_#_domain#_FieldLookups where ownerId = and ownerType = and fieldName = delete from tbl_WRK_Conditions where ownerId = and ownerType = and targetType = 'L' and targetKey like '#_fieldId#:%' select * from qmd_fieldLookups order by alphaSort select * from qmd_fieldLookups order by numericSort, alphaSort select * from qmd_fieldLookups order by sortRank insert into tbl_#_domain#_FieldLookups ( ownerId, ownerType, fieldName, selectionValue, selectionLabel, sortRank ) values ( , , , , , ) insert into tbl_WRK_Conditions ( ownerId, ownerType, targetType, targetKey, sourceFieldId, sourceFieldOp, sourceFieldValue ) values ( , , 'L', , , , )