Santry Technology Solutions, Content Management, DotNetNuke, SharePoint Consulting
Register | Login
Saturday, July 04, 2009

Sections
  
About Us
  
Partners
Downloads
  
 WWWCoder.com Resource Directory

Replace Text via SQL Replace in a DNN HTMLText Module
10/19/2008 4:54:33 PM

When migrating portals from one instance to another, you can use the template creation in DotNetNuke to export a template with content and then import that template to another instance. The problem you end up with however is the links tend to break as your portals directory usually has another id assigned to it.

When migrating portals from one instance to another, you can use the template creation in DotNetNuke to export a template with content and then import that template to another instance. The problem you end up with however is the links tend to break as your portals directory usually has another id assigned to it.
With SQL 2005 you can use the replace function to replace some text, but you're dealing with an ntext field, and you also don't want to run the replace on all DesktopModules if you have a multi portal instance.

Here's a SQL 2005 stored procedure that will accept the text you want to find, what to replace it with, and restrict the search to a specific portal.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

ALTER PROCEDURE [dbo].[ReplaceDNNHTMLText]
@replace nvarchar(40),
@find nvarchar(40),
@PortalID int
As
update HTMLText Set DesktopHTML = cast(replace(cast(DesktopHTML as nvarchar(max)),@find,@replace) as ntext) 
from HTMLText WHERE ModuleID In (Select ModuleID from Modules WHERE PortalID = @PortalID)
AND DesktopHTML Like '%' + @find + '%'


Page Options:
format for printing  Format for Printer
email article  Email Page
add to your favorites   Add to Favorites
How would you rate the quality of this content?
Poor - - Excellent
Comments?
Overall Rating: No ratings available.
Comments Left:
Left on 6/26/2009 7:17:11 AM by Anonymous
Comments: zdfgd
No ratings available.
Left on 3/4/2009 11:27:41 AM by Anonymous
Comments:
No ratings available.
  

 Latest Articles
  

 Latest News
  

 

Spotlight
Syndication

 


 


Digg This
 


DotNetNuke Platinum Benefactor

  
 

 Terms Of Use | Privacy Statement
 Copyright 2008 - Santry Technology Solutions, Box 172, Girard, PA 16417, (814) 774-0970