This article provides the SQL script to replace strings in the Modules table.
9.x and later
Access to DNN database
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
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
@REPLACEstring variables and the
PortalIDwhere 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';
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
After restarting your application, go to the page where the old string was present and check if it has been replaced.