Nathan Riley
asked on
Query Replace Help
I'm trying to do a replace on a filed that has many different options.
filedname = post, table = posts
I want to update these to make them look like:
filedname = post, table = posts
[url=http://domain.com/blah.flv]blah video[/url]
[url=http://domain.com/video/name.mp4]name of him[/url]
[url=http://domain.com/video/2001/funny.flv]funny clip[/url]
I want to update these to make them look like:
[media]http://domain.com/blah.flv[/media]
[media]http://domain.com/video/name.mp4[/media]
[media]http://domain.com/video/2001/funny.flv[/media]
ASKER
can you put all that in code tags so I can see it, the url tags disappeared haha.
Here
update table
set fieldname = REPLACE(fieldname, '')
update table
set fieldname =REPLACE(fieldname, '', '[/media]')
Not that, let me redo
Here is the correct one
update table
set fieldname = REPLACE(fieldname, '[url=', '[media]')
update table
set fieldname =REPLACE(fieldname, '[/url]', '[/media]')
ASKER
Well, that still doesn't get me there that will make the result set be:
but what I need is:
[media]http://domain.com/blah.flv]blah video[/media]
[media]http://domain.com/video/name.mp4]name of him[/media]
[media]http://domain.com/video/2001/funny.flv]funny clip[/media]
but what I need is:
[media]http://domain.com/blah.flv[/media]
[media]http://domain.com/video/name.mp4[/media]
[media]http://domain.com/video/2001/funny.flv[/media]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
set fieldname = REPLACE(fieldname, '')
update table
set fieldname =REPLACE(fieldname, '', '[/media]')