In my database, I have two tables: Forum and Files

Files have two fields. First one is FileID and second one is FileAddress.

FileId field is fine. but in FileAddress field I have a lot of urls. I want to just change certain parts of url. For example, instead of having http://ipaddress/FILEPATH

I want to chage that to http://domain.com/FILEPATH for about 400 data in the sql table. How do I do this?????

Recommended Answers

All 2 Replies

In my database, I have two tables: Forum and Files

Files have two fields. First one is FileID and second one is FileAddress.

FileId field is fine. but in FileAddress field I have a lot of urls. I want to just change certain parts of url. For example, instead of having http://ipaddress/FILEPATH

I want to chage that to http://domain.com/FILEPATH for about 400 data in the sql table. How do I do this?????

Hi Desiguru,
You could use the stuff function e.g.
stuff( 'http://ipaddress/FILEPATH', 8, 9, 'domain.com')
this will replace from character 8 the 9 characters 'ipaddress' with 'domain.com'
but you would obviously replace the string to be modified with the field name

stuff( FileAddress, 8, 9, 'domain.com')

and you would obviously need to select the appropriate records

Regards

Rob

Also, look at the SUBSTITUTE function

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.