Skip to content

Instantly share code, notes, and snippets.

@jonezy
Created August 19, 2010 14:30
Show Gist options
  • Save jonezy/538013 to your computer and use it in GitHub Desktop.
Save jonezy/538013 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 production to local dev
just update @ClientIdentifier to match the clients theme directory name.
WARNING: only run this locally, handwrite something if your going from local to prod
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)), '/admin/theme/','/'+ @ClientIdentifier +'/admin/theme/') as ntext)
WHERE SUBSTRING(HtmlText, 0, 6) = '/admin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment