Some systems support Document Categories and others support Folders.
- --When a document has a category, prepend the folder with the document category.
- UPDATE __M_Documents_Digital_Files SET --Prepend the Category Final_Folder_RelativePath = CONCAT('\', V2.Final_Subject, Final_Folder_RelativePath) FROM __M_Documents_Digital_Files V1, __M_Documents_Digital_Categories V2 WHERE 1=1 AND V1.Final_DocumentCategory_Id = V2.Id
- --Only Prepend it where there is no folder
- AND Final_Folder_RelativePath = '\'
- --Don't prepend the category if it has already been prepended.
- AND CHARINDEX(
- CONCAT('\', V2.Final_Subject, '\'),
- V1.Final_Folder_RelativePath
- ) = 0
- --Replace \\ with \
- UPDATE
- __M_Documents_Digital_Files
- SET
- Final_Folder_RelativePath = REPLACE(Final_Folder_RelativePath, '\\', '\')