Text data retrieved and appended
Posted by mholmes on 23 Aug 2010 in Activity log
These custom fields had cfd_text which needed to be appended to doc_notes:
- 32
- 77
- 81
- 83
This had cfd_text which needed to be appended to doc_people:
- 39
These custom fields had cfd_str which needed to be appended to doc_people:
- 34
- 35
- 36
- 37
- 38
- 88
It appears that the truncation happens when appending a NULL value onto any string field, so this kind of statement will actually work where the previous formulations failed:
UPDATE `documents` SET `doc_people` = concat(`doc_people`, ' \r ', (SELECT `cfd_text` FROM `customFieldData` WHERE `customFieldData`.`cfd_to_cf_id` = "39" AND `customFieldData`.`cfd_to_doc_id` = `documents`.`doc_id`)) WHERE EXISTS (SELECT * FROM `customFieldData` WHERE `customFieldData`.`cfd_to_cf_id` = "39" AND `customFieldData`.`cfd_to_doc_id` = `documents`.`doc_id` AND LENGTH(`customFieldData`.`cfd_text`) > 0);
So I worked from a reconstructed copy of the old customFieldData table, and reworked my scripts to append the data successfully. After testing on the dev db, I made the same changes to the live db for the four doc_notes items. I'm now proceeding with the disStatus script. I'll update my previous posts to include corrected scripts.