This script will search and replace sitemap links/titles/etc
set xact_abort on declare @currurl nvarchar(500) declare @newurl nvarchar(500) declare @search nvarchar(500) declare @replace varchar(500) set @search = '' --string to find set @replace = '' --replacement string declare @pos int declare @id bigint declare @ol int declare @lang int begin tran declare curs cursor local fast_forward for select FolderId,Url,OrderLocation,ContentLanguage from sitemap where url like '%' + @search +'%' open curs fetch next from curs into @id,@currurl,@ol,@lang while @@fetch_status = 0 begin --print 'Url before update=' + @currurl Set @newurl = replace(@currurl,@search,@replace) Update SiteMap Set Url = @newurl where folderid = @id and orderlocation = @ol and contentlanguage = @lang --print 'Url after update=' + @newurl fetch next from curs into @id,@currurl,@ol,@lang 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
Originally Posted on October 23, 2013
Last Updated on October 26, 2015
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.