Last active
August 29, 2015 14:02
-
-
Save roman-yagodin/64ba3158b36354ed16cd to your computer and use it in GitHub Desktop.
T-SQL SPs for sync folder rename in DNN Platform with content in HTML, Blog and Forum modules from common/YYMMDD to common/YY/YYMMDD sheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [Dotnetnuke7] | |
GO | |
/****** Object: StoredProcedure [dbo].[RenameFolder_DoRename] Script Date: 09.06.2014 11:56:33 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
-- ============================================= | |
-- Author: <Author,,Name> | |
-- Create date: <Create Date,,> | |
-- Description: <Description,,> | |
-- ============================================= | |
CREATE PROCEDURE [dbo].[RenameFolder_DoRename] | |
@year nvarchar(10), | |
@portalId int | |
AS | |
BEGIN | |
-- SET NOCOUNT ON added to prevent extra result sets from | |
-- interfering with SELECT statements. | |
SET NOCOUNT ON; | |
UPDATE dbo.HtmlText SET Content = REPLACE( CAST(Content AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) | |
WHERE Content LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
UPDATE dbo.Blog_Entries SET [Entry] = REPLACE( CAST([Entry] AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) | |
WHERE [Entry] LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
UPDATE dbo.Blog_Entries SET [Description] = REPLACE( CAST([Description] AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) | |
WHERE [Description] LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
UPDATE dbo.Forum_Posts SET Body = REPLACE( CAST(Body AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) | |
WHERE Body LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [Dotnetnuke7] | |
GO | |
/****** Object: StoredProcedure [dbo].[RenameFolder_Preview] Script Date: 09.06.2014 11:52:57 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
-- ============================================= | |
-- Author: <Author,,Name> | |
-- Create date: <Create Date,,> | |
-- Description: <Description,,> | |
-- ============================================= | |
CREATE PROCEDURE [dbo].[RenameFolder_Preview] | |
@year nvarchar(10), | |
@portalId int | |
AS | |
BEGIN | |
-- SET NOCOUNT ON added to prevent extra result sets from | |
-- interfering with SELECT statements. | |
SET NOCOUNT ON; | |
SELECT REPLACE( CAST(Content AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) AS Content | |
FROM dbo.HtmlText | |
WHERE Content LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
SELECT REPLACE(SettingValue, CONCAT('common/', @year) , CONCAT('common/', @year, '/', @year)) AS ModuleSetting | |
FROM dbo.ModuleSettings | |
WHERE SettingValue LIKE CONCAT('%common/', @year, '%') | |
SELECT REPLACE(SettingValue, CONCAT('common/', @year) , CONCAT('common/', @year, '/', @year)) AS TabModuleSetting | |
FROM dbo.TabModuleSettings | |
WHERE SettingValue LIKE CONCAT('%common/', @year, '%') | |
SELECT REPLACE( CAST([Entry] AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) AS [BlogEntry] | |
FROM dbo.Blog_Entries | |
WHERE [Entry] LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
SELECT REPLACE( CAST([Description] AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) AS [BlogDescription] | |
FROM dbo.Blog_Entries | |
WHERE [Description] LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
SELECT REPLACE( CAST([Body] AS nvarchar(max)), | |
CONCAT('/', @portalId, '/common/', @year), CONCAT('/', @portalId,'/common/', @year, '/', @year)) AS [ForumPost] | |
FROM dbo.Forum_Posts | |
WHERE [Body] LIKE CONCAT('%/', @portalId,'/common/', @year, '%') | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [Dotnetnuke7] | |
GO | |
/****** Object: StoredProcedure [dbo].[RenameFolder_UpdateSettings] Script Date: 09.06.2014 11:57:19 ******/ | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
-- ============================================= | |
-- Author: <Author,,Name> | |
-- Create date: <Create Date,,> | |
-- Description: <Description,,> | |
-- ============================================= | |
CREATE PROCEDURE [dbo].[RenameFolder_UpdateSettings] | |
@year nvarchar(10) | |
AS | |
BEGIN | |
-- SET NOCOUNT ON added to prevent extra result sets from | |
-- interfering with SELECT statements. | |
SET NOCOUNT ON; | |
UPDATE dbo.ModuleSettings | |
SET SettingValue = REPLACE(SettingValue, CONCAT('common/', @year) , CONCAT('common/', @year, '/', @year)) | |
WHERE SettingValue LIKE CONCAT('%common/', @year, '%') | |
UPDATE dbo.TabModuleSettings | |
SET SettingValue = REPLACE(SettingValue, CONCAT('common/', @year) , CONCAT('common/', @year, '/', @year)) | |
WHERE SettingValue LIKE CONCAT('%common/', @year, '%') | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment