Skip to content

Instantly share code, notes, and snippets.

@jonezy
Created August 20, 2010 14:06
Show Gist options
  • Save jonezy/540385 to your computer and use it in GitHub Desktop.
Save jonezy/540385 to your computer and use it in GitHub Desktop.
/*
prepends the client identifier to all occurences of a theme directory call
useful for when moving data from local to production
just update @ClientIdentifier to match the clients theme directory name.
WARNING: YOU HAVE TO MANUALLY SET THE LENGTH IN SUBSTRING(HtmlText, 0, 6) = @ClientIdentifier TO MATCH THE LENGTH OF THE @ClientIdentifier.
If you need to debug, just use this statement
SELECT CAST(REPLACE(CAST(HtmlText as nvarchar(max)), '/admin/theme/','/'+ @ClientIdentifier +'/admin/theme/') as ntext) FROM Html
*/
DECLARE @ClientIdentifier nvarchar(max)
SET @ClientIdentifier = 'Xpert22'
UPDATE Html
SET HtmlText = CAST(REPLACE(CAST(HtmlText as nvarchar(max)),'/'+ @ClientIdentifier +'/admin/theme/', '/admin/theme/') as ntext)
WHERE SUBSTRING(HtmlText, 0, 6) = @ClientIdentifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment