I need to replace all iframe tags, stored as nvarchar in my database. I can find the entries using the following sql-question:
SELECT * FROM databasename..Ve
I would consider writing a CLR replace function with RegEx support for this kind of string manipulation.
I think 2 update calls should do
update VersionedFields
set Value = replace(value,'<iframe','<a><iframe')
update VersionedFields
set Value = replace(value,'> </iframe>','</a>')
update VersionedFields
set Value = replace(replace(value,'<iframe','<a>iframe'), '> </iframe>','</a>')
and you do it in a single pass.
Update database and Set fieldName=Replace (fieldName,'FindString','ReplaceString')
You can do it with an UPDATE statement setting the value with a REPLACE
UPDATE
Table
SET
Column = Replace(Column, 'find value', 'replacement value')
WHERE
xxx
You will want to be extremely careful when doing this! I highly recommend doing a backup first.
I was just faced with a similar problem. I exported the contents of the db into one sql file and used TextEdit to find and replace everything I needed. Simplicity ftw!