Overview
This article provides the SQL script to replace strings in the Modules table.
Environment
9.x and later
Requirements
Access to DNN database
Process
The script provided replaces strings in the module contents. Do note that It might be possible that the content you want is not inside the Modules
table but in other tables, like localization
.
Note: It is recommended to always take a backup of the database before running SQL queries.
- Open Microsoft SQL Server Management Studio and connect to your database.
- Click on the New Query button.
- Run the query below.
Note: Do not forget to replace the values of your@FIND
and@REPLACE
string variables and thePortalID
where you want to replace these values, in case you have multiple Portals in the database. Please refer to the article Default Workflow to find your Portal ID.
DECLARE @PortalID AS INT = Portal-ID-Goes-Here;
DECLARE @Find AS NVARCHAR(MAX) = 'Old Value';
DECLARE @Replace AS NVARCHAR(MAX) = 'New Value';
UPDATE H
SET H.Content = REPLACE(CAST(H.Content as NVarchar(MAX)), @Find, @Replace)
FROM HtmlText H
INNER JOIN Modules M
ON H.Moduleid = M.ModuleID
WHERE H.Content LIKE '%' + @Find + '%'
AND M.PortalID = @PortalID
Validation
After restarting your application, go to the page where the old string was present and check if it has been replaced.
Comments
0 comments
Article is closed for comments.