I have a user and they have a bunch of data that was imported over a few months. The data had ".." in the folder name as well as in one of the metadata fields in the template. Is there a way to make these changes inside the SQL DB rather than going in and fixing hundreds of files manually?
Question
Question
Answer
One option would be to use Workflow to look for these folders with bad names or entries with bad field data and fix the values there.
However, if the customer is comfortable with modifying the database directly, then you can run a query using the replace function on the name column in the toc table and the str_val and short_str_val columns in the propval table. It goes without saying, but please backup the database before making any changes.
Replies
Chad,
For reference here are two SQL UPDATE statements that accomplish your goal. As Alex shares, please make sure they have a good backup before running the SQL statements. (I actually like the idea of the workflow model!)
Note: In both statements we are replacing the '..' with an empty string (''), perhaps a better replacement of the '..' would be a space?
To update the folder names;
UPDATE dbo.toc SET dbo.toc.name = REPLACE(dbo.toc.name, '..','') WHERE dbo.toc.etype = 0 AND dbo.toc.name LIKE '%..%'
To update the metadata fields;
UPDATE dbo.propval SET dbo.propval.str_val = REPLACE(dbo.propval.str_val,'..',''), dbo.propval.short_str_val = REPLACE(dbo.propval.short_str_val,'..','') WHERE dbo.propval.str_val LIKE '%..%' OR dbo.propval.short_str_val LIKE '%..%'
Have a similar issue here... I have some find/replace corrections which need to be done on just a specific field. How can this be accomplished on just a single field?
Thanks!!