This script will rename folder paths of renamed CMS folders.
SET XACT_ABORT ON BEGIN TRAN DECLARE @currtext NVARCHAR(255) DECLARE @newtext NVARCHAR(255) DECLARE @search NVARCHAR(500) DECLARE @replace VARCHAR(500) DECLARE @pos INT DECLARE @id BIGINT DECLARE @libtype_id INT -- folder names SET @search = '' --string to find SET @replace = '' --replacement string DECLARE curs CURSOR LOCAL FAST_FORWARD FOR SELECT folder_id ,folder_name ,libtype_id FROM library_folder_tbl WHERE folder_name LIKE '%' + @search + '%' OPEN curs FETCH NEXT FROM curs INTO @id ,@currtext ,@libtype_id WHILE @@fetch_status = 0 BEGIN SET @newtext = replace(@currtext, @search, @replace) PRINT 'Changing ' + @currtext + ' to ' + @newtext UPDATE library_folder_tbl SET folder_name = @newtext WHERE folder_id = @id AND libtype_id = @libtype_id FETCH NEXT FROM curs INTO @id ,@currtext ,@libtype_id END CLOSE curs DEALLOCATE curs -- subfolder paths SET @search = '' --string to find SET @replace = '' --replacement string DECLARE curs CURSOR LOCAL FAST_FORWARD FOR SELECT folder_id ,subfolder ,libtype_id FROM library_folder_tbl WHERE subfolder LIKE '%' + @search + '%' OPEN curs FETCH NEXT FROM curs INTO @id ,@currtext ,@libtype_id WHILE @@fetch_status = 0 BEGIN SET @newtext = replace(@currtext, @search, @replace) PRINT 'Changing ' + @currtext + ' to ' + @newtext UPDATE library_folder_tbl SET subfolder = @newtext WHERE folder_id = @id AND libtype_id = @libtype_id FETCH NEXT FROM curs INTO @id ,@currtext ,@libtype_id END CLOSE curs DEALLOCATE curs --rollback tran COMMIT TRAN
Source: http://www.skonet.com/Articles_Archive/Helpful_Sql_Scripts_for_Ektron_CMS_400_Net.aspx
Last Updated on October 26, 2015