Sql script to delete section of text?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
richandfruity
Forum Newbie
Posts: 1
Joined: Mon May 25, 2009 10:06 am

Sql script to delete section of text?

Post by richandfruity »

Hi everyone

I am hoping someone could help. My website uses a database which via a feed from an external database (which I do not have access to) updates every day and includes image URLS.

The problem I have is the feed inputs the image url like

Code: Select all

http://www.mysite.com/images/imagespicture1.jpg
What I need to be able to run is a SQl script that gets rid of the word images before the picture name. In the example above the result would be

Code: Select all

http://www.mysite.com/images/picture1.jpg
I have looked at UPDATE statements but haven't been able to figure out a way of truncating just that part of the URL.

If anyone could help that would be jolly marvellous!

Regards
peter
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: Sql script to delete section of text?

Post by andyhoneycutt »

you should take a look at the mysql replace function.

-Andy
Post Reply